|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] position() of the parent
Hello,
I am new to XML and I am trying to write an XSL sheet that "flattens" the source XML tree, but preserves information about child-parent relationships. For example:
<mynode name="xxx">
<mynode name="yyy">
<mynode name="zzz">
</mynode>
</mynode>
</mynode>
should become
<mynode name="xxx" id="1" parentid=""/>
<mynode name="yyy" id="2" parentid="1"/>
<mynode name="zzz" id="3" parentid="2"/>
I don't really care what the data type of the id's is.
I've tried something like:
<xsl:template match="mynode">
<mynode name="{@name}">
<xsl:attribute name="id">
<xsl:value-of select="position()"/>
</xsl:attribute>
</mynode>
</xsl:template>
but I don't know how to apply the position() function to the parent node.
Thank you,
Alex
LYCOShop. Thousands of products! One location!
http://shop.lycos.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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








