Subject: RE: [xsl] "Line"-Tokenizing at <br/> in xhtml From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Tue, 7 Nov 2006 14:17:23 -0000 |
So long as the <br/> elements are children of the <p> element (not descendants), you can use <xsl:for-each-group group-starting-with="br"> This will include the br element as a member of the group, but you can easily lose it using current-group()[not(self::br)] (You can use group-ending-with="br" as well, but if you drop the br elements the effect is identical). Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Georges Schmitz [mailto:georges.schmitz@xxxxxxxxx] > Sent: 07 November 2006 13:47 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] "Line"-Tokenizing at <br/> in xhtml > > Tokenizing a string at LFs and putting <br/> in place of > them is well known to me (in XSLT2.0), but for the moment I'm > stuck with the other way round. > > I have something like this (xhtml): > > <p>blabla blabla <br/> > blabla blabla blabla <br/> > blabla <b>blabla</b> blabla <br/> > blabla blabla blabla</p> > > I need to have access to every single "line" (terminated by > <br/>), preserving the mixed content of the lines. > > 1. The tokenize() function as well as the analyze-string > method only > operate on strings, not on mixed content. > 2. <for-each select=".//text()"> (just posted some days > ago) doesn't > work because of line 3, and > 3. <xsl:for-each select="br"> > <xsl:value-of select="preceding-sibling::text()[1]"/> > </xsl:for-each> > a) doesn't work because of line 3 > b) I would have to fetch the last line separately > > Thanks for any advise, > Georges Schmitz
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] "Line"-Tokenizing at <br/, David Carlisle | Thread | Re: [xsl] "Line"-Tokenizing at <br/, Georges Schmitz |
RE: [xsl] xslt 1.1 xsl:document, Michael Kay | Date | [xsl] RE: Help needed to transform , Kota, Ganesh |
Month |