[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] what does this statement mean?
Hi
Im trying to rearrange the order of my XML elements using the <xsl:copy> feature of XSLT 2.0. However Im having trouble with one line of code which causes my processor to run into an infinite loop. Could someone please let me know what this particular <xsl:apply-templates select="*[1]" mode="walker"/> means and what exactly its trying to do (this was a piece of code that was suggested by someone from this list).
<xsl:template match="SubConcepts"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:for-each select="descendant::SubConcept"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:apply-templates select="*[1]" mode="walker"/> <!--problem with this line of code--> </xsl:copy> </xsl:for-each> </xsl:copy> </xsl:template> <xsl:template match="Value | ChildConcept" mode="walker"> <!-- problems during execution--> <xsl:apply-templates select="."/> <xsl:apply-templates select="following-sibling::*" mode="walker"/> </xsl:template> <xsl:template match="*" mode="walker"> <!-- problems during execution--> <xsl:apply-templates select="following-sibling::*" mode="walker"/> </xsl:template> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet>
<Top> <PrimeConcept id="0001" type="none">A</PrimeConcept> <SubConcepts> <SubConcept id="0002" name="A1"> <Value ref="0003">hasProperty1 AB</Value> <Value ref="0004">hasProperty2 XY</Value> <SubConcept id="0004" name="XY"> <ChildConcept ref="0005">XY1</ChildConcept> <SubConcept id="0005" name="XY1"> <ChildConcept ref="0007">XY11</ChildConcept> <ChildConcept ref="0008">XY12</ChildConcept> </SubConcept> <ChildConcept ref="0006">XY2</ChildConcept> </SubConcept> </SubConcept> </SubConcepts> </Top> ---------------- The desired output is ---------------- <Top> <PrimeConcept id="0001" type="none">A</PrimeConcept> <SubConcepts> <SubConcept id="0002" name="A1"> <Value ref="0003">hasProperty1 AB</Value> <Value ref="0004">hasProperty2 XY</Value> </SubConcept> <SubConcept id="0004" name="XY"> <ChildConcept ref="0005">XY1</ChildConcept> <ChildConcept ref="0006">XY2</ChildConcept> </SubConcept> <SubConcept id="0005" name="XY1"> <ChildConcept ref="0007">XY11</ChildConcept> <ChildConcept ref="0008">XY12</ChildConcept> </SubConcept> </SubConcepts> </Top> --------------- Thanks Rahil
|
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
|