| Subject: position() of the parent From: "Alexandru-Ionut Albu" <albu@xxxxxxxxxxxx> Date: Wed, 19 Jan 2000 16:59:47 -0500 | 
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 | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| Re: xml typesetting, Sebastian Rahtz | Thread | Re: position() of the parent, David Carlisle | 
| Re: xml typesetting, Sebastian Rahtz | Date | Re: position() of the parent, David Carlisle | 
| Month |