Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

XSLT variable not recognized

I’ve worked with XSLT variables before, but for some reason, I can not get the stylesheet to see an assigned variable. When I copy sample code it seems to work, so it has to be something I’m doing wrong. Below is the code.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
    <xsl:template match="/JDF">
    <xsl:variable name="customer" 
        select="/JDF/ResourcePool[1]/CustomerInfo[1]/@CustomerID"/>
            <job>
                <jobInfo>$customer</jobInfo>
            </job>
    </xsl:template>
</xsl:stylesheet>

When I run the above the result is this.

<?xml version="1.0" encoding="UTF-8"?>
<job>
   <jobInfo>$customer</jobInfo>
</job>

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Change

<jobInfo>$customer</jobInfo>

to

<jobInfo>
  <xsl:value-of select="$customer"/>
</jobInfo>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading