|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Determine the position of an element relative to its
I want to use the position of an element ralative to its siblings to construct an xpath to another element. For example, Input: <TABLE> <THEAD> <TR> <TD>Header Col 1<A class="sort">Sort</A></TD> <TD>Header Col 2<A class="sort">Sort</A></TD> </TR> </THEAD> <TBODY> <TR> <TD id="column1">Col 1 Prototype</TD> <TD id="column2">Col 2 Prototype</TD> </TR> </TBODY> </TABLE> Template: <xsl:template match="A[@class='sort']"> <A> <xsl:attribute name="url"> base?field=<xsl:value-of select="ancestor::TABLE/TBODY/TR/TD[<what goes here?>]/@id"/> </xsl:attribute> </A> </xsl:template> Output: <TABLE> <THEAD> <TR> <TD>Header 1<A url="base?field=column1" class="sort">Sort</A></TD> <TD>Header 2<A url="base?field=column2" class="sort">Sort</A></TD> </TR> </THEAD> <TBODY> <TR> <TD id="column1">Col 1 Prototype</TD> <TD id="column2">Col 2 Prototype</TD> </TR> </TBODY> </TABLE> Things I have tried in <what goes here?>: position() for $i in ../TD return if (generate-id(../TD[$i]) = generate-id(..)) then $i else 0 And various other things to no avail. I'm sure there is an easy way to do this but searching for position and element adnosium finds thousands of hits. My eyeballs are crosseyed from reading so many wonderful list entries about stuff that I'm sure will help me in the long run but are not solving my immediate problem. Thanks for any advice, hints, etc. Douglas Ross Developer, HTML UI Framework Kronos E-mail: dross@xxxxxxxxxx www.kronos.com
|
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








