Magyary Endre wrote:
I need to transform an element value to an attribute value:
input:
<element>
<element.name>hello</element.name>
</element>
output:
<element name="hello"/>
I have no idea ho to refer the element's value in an xsl:template
Thank you, Endre
try this:
<xsl:template match="element">
<xsl:for-each select="*">
<xsl:variable name="attname" select="substring-after(local-
name(),'element.')"/>
<xsl:if test="$attname != ''">
<element>
<xsl:attribute name="{$attname}"><xsl:value-of
select="."/>
</xsl:attribute>
</element>
</xsl:if>
</xsl:for-each>
</xsl:template>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list