Hi!
I have code that I expect to return the element name, but nothing is returned.
The following code is from an XSL doc that generates another XSL doc.. where $expression is a variable that dynamically created an XPath expression.
<xsl:template match="/">
...
<xslt:template match="{$expression}">
<elem key="{name()}">
<xslt:copy-of select="@*"/>
<xslt:for-each select="@*">
<xslt:sort select="name()"/>
<attribute>|<xslt:value-of select="name()"/>|</attribute>
</xslt:for-each>
</elem>
</xslt:template>
...
</xsl:template>
That code then generates the second XSL doc with this code.. notice how @key is blank.
<xsl:template match="//*[@name='Spot']">
<elem key="">
<xsl:copy-of select="@*" />
<xsl:for-each select="@*">
<xsl:sort select="name()" />
<attribute>|<xsl:value-of select="name()" />|</attribute>
</xsl:for-each>
</elem>
</xsl:template>
Besides the @key being blank, everything works as expected. My only problem is displaying the name of the element.
EDIT: To clarify what I'm actually looking for, I need the names of the elements from the results returned by <xslt:template match="{$expression}">
.
Thanks! :)