|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: generate full xpath name to an attribute? (it work
At 09:39 AM 4/4/03 +0100, you wrote:
yes, i got the following to work: yes, i added that so: <xsl:template name="getPath"> <xsl:for-each select="ancestor-or-self::*"> <xsl:text>/</xsl:text> <xsl:value-of select="name()"/> <xsl:if test="name() = 'Node'"> <xsl:variable name="thisPosition" select="count(preceding-sibling::*)"/> <xsl:value-of select="concat('[', $thisPosition + 1, ']')"/> </xsl:if> <xsl:if test="name() = 'Connection'"> <xsl:variable name="thisPosition" select="count(preceding-sibling::*)"/> <xsl:value-of select="concat('[', $thisPosition + 1, ']')"/> </xsl:if> </xsl:for-each> <xsl:text>/@</xsl:text> <xsl:value-of select="name()"/> </xsl:template> and using it like: <xsl:template match="Point"> <td> <xsl:for-each select="@*"> <xsl:variable name="path"> <xsl:call-template name="getPath"/> <!-- call the getpath function and save the result --> </xsl:variable> <xsl:element name="label"> <xsl:attribute name="for"><xsl:value-of select="name()"/></xsl:attribute> <xsl:value-of select="name()"/> </xsl:element> <xsl:element name="input"> <xsl:attribute name="type">text</xsl:attribute> <xsl:attribute name="size">4</xsl:attribute> <xsl:attribute name="id"><xsl:value-of select="name()"/></xsl:attribute> <xsl:attribute name="name"><xsl:value-of select="$path"/></xsl:attribute> <!-- use the result here! --> <xsl:attribute name="value"><xsl:value-of select="."/></xsl:attribute> </xsl:element> <xsl:value-of select="$path"/> </xsl:for-each> </td> </xsl:template> works like a charm :) thanks for all your assistance people! --- ray tayek http://tayek.com/ actively seeking mentoring or telecommuting work vice chair orange county java users group http://www.ocjug.org/ hate spam? http://samspade.org/ssw/ 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








