Create global variable in XSL from specific tag in XML

dex

New Member
I'm having trouble creating a global variable in my XSL 1.0 stylesheet. I want to create the variable from the value of an XML tag that is in the XML I'm trying to transform. Here is what my XML looks like:\[code\]<?xml version="1.0" encoding="UTF-8" standalone="no"?><config name="test report" xmlns="http://www.example.com/CONFIG"> <the_one_i_want>1000</the_one_i_want> <!-- lots of other stuff --></config>\[/code\]And here is what my XSL looks like:\[code\]<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:CONFIG="http://www.example.com/CONFIG"> <xsl:output method="html"/> <xsl:variable name="normal_global_variable">100</xsl:variable><!-- This works fine --> <xsl:variable name="variable_from_xml"><xsl:value-of select="/config/the_one_i_want/value"/></xsl:variable><!-- This does not work --> <!-- lots of other stuff --></xsl:stylesheet>\[/code\]So I would expect that \[code\]variable_from_xml\[/code\] would have a value of \[code\]1000\[/code\], but it does not. What am I doing wrong?P.S. The XML tag named \[code\]the_one_i_want\[/code\] is unique and only appears once in my XML.
 
Back
Top