At 09:39 AM 4/4/03 +0100, you wrote:
yes, i got the following to work:
<xsl:template name="foo">
...
<xsl:text>@</xsl:text>
...
That's __still__ not right: you need /@ not @
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