I have this xslt, how to substitute the variable value between element name?
Code:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:x="cds_dt"> <xsl:output omit-xml-declaration="yes" indent="yes"/> <xsl:strip-space elements="*"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="customfields">
<xsl:copy>
<xsl:apply-templates select="child::node([not(self::customfield)]"/>
</xsl:copy>
</xsl:template>
<xsl:apply-templates select="customfield"/>
<xsl:template match="customfield">
<xsl:for-each select=".">
<xsl:variable name="temp" select="./customfieldname"/> <xsl:variable name="temp2"select="../customfieldvalue"/> <xsl:element name="{$temp}"><xsl:value-of select="$temp2" /></xsl:element>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Comment