Subject: Re: [xsl] Trying to select sibling nodes between two nodes From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Fri, 08 Jan 2010 17:19:46 -0500 |
I have some unfortunate xml that I am trying to parse:
<label>first text<br/>second<emphasis>bold</emphasis> text<br/>third text</label>
I need to transform this into:
<label> <flowPara>first text</flowPara> <flowPara>second<emphasis>bold</emphasis> text</flowPara> <flowPara>third text</flowPara> </label>
Basically I need to select nodes between nodes in a "flat" data progression. I can think of some ugly approaches that would accomplish this but it seems I should be able to use "<<" and ">>" to select nodes between occurrences of <br/>. However, no matter how I attempt to use these operators the result is a syntax error with "<" being illegal.
Can anyone point me to an example of how I can unflatten this xml?
<xsl:template match="label"> <label> <xsl:for-each-group select="node()" group-starting-with="br"> <flowPara> <xsl:copy-of select="current-group()[not(self::br)]"/> </flowPara> </xsl:for-each-group> </label> </xsl:template>
</xsl:stylesheet> T:\ftemp>
-- UBL and Code List training: Copenhagen, Denmark 2010-02-08/10 XSLT/XQuery/XPath training after http://XMLPrague.cz 2010-03-15/19 XSLT/XQuery/XPath training: San Carlos, California 2010-04-26/30 Vote for your XML training: http://www.CraneSoftwrights.com/s/i/ Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Trying to select sibling node, Ylvisaker, Steve | Thread | RE: [xsl] Trying to select sibling , Ylvisaker, Steve |
[xsl] Trying to select sibling node, Ylvisaker, Steve | Date | RE: [xsl] Trying to select sibling , Ylvisaker, Steve |
Month |