|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] xsl:for-each-group question
Unsing xsl 2.0
The below xsl changes the below xml with a list of flat <P/> nodes into
groups based on values in subnodes of <p/>
The result achived with the xsl below is what I want.
But what I cannot figure out is:
What values must the "select" argument and/or the "group-starting-with"
arguments have in my example
so that the resulting current-group() nodes are <p/> nodes (i.e. the parent
node) instead of <rStyle/> nodes.
I cannot achieve the wanted grouping with the resulting current-group()
nodes being <p/> nodes.
I can only achieve the wanted grouping with the resulting current-group()
nodes being <rStyle/> nodes.
Thank you for any help.
Kind regards
Markus
XML INPUT File:
<Root>
<p>
<rStyle val="Lemma"/>
</p>
<p>
<rStyle val="description"/>
</p>
<p>
<rStyle val="Lemma"/>
</p>
<p>
<rStyle val="description"/>
</p>
<p>
<rStyle val="description"/>
</p>
<p>
<rStyle val="Lemma"/>
</p>
<p>
<rStyle val="description"/>
</p>
<p>
<rStyle val="description"/>
</p>
<p>
<rStyle val="description"/>
</p>
<p>
<rStyle val="description"/>
</p>
</Root>
################ XSL Processing FILE extract
###################################
<xsl:template match="Root">
<xsl:copy>
<xsl:for-each-group select="p/rStyle"
group-starting-with="p/rStyle[@val='Lemma']">
<service>
<!--
This is what I really want as current-group()
<xsl:copy-of select="current-group()/parent::node() "/>
-->
<xsl:copy-of select="current-group()"/>
</service>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>
################ Desired Result XML snippet
###################################
<service>
<p>
<rStyle val="Lemma"/>
</p>
<p>
<rStyle val="description"/>
</p>
<p>
<rStyle val="description"/>
</p>
</service>
################ Current Result XML snippet
#########################################
<service >
<rStyle val="Lemma"/>
<rStyle val="description"/>
<rStyle val="description"/>
</service>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








