[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

position() of the parent

Subject: position() of the parent
From: "Alexandru-Ionut Albu" <albu@xxxxxxxxxxxx>
Date: Wed, 19 Jan 2000 16:59:47 -0500
xml position 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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.