How to substitute variable value?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kesi
    New Member
    • Apr 2014
    • 1

    How to substitute variable value?

    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>
    Last edited by Rabbit; Apr 24 '14, 04:47 AM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    which one?

    Comment

    Working...