This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Problem with using $variable in xsl:value-of
- From: "Jochen Metzger" <j dot metzger at steptown dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Wed, 18 Sep 2002 20:42:18 +0200
- Subject: [xsl] Problem with using $variable in xsl:value-of
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi folks,
I want to use the value of a variable to define a path in XPath, but:
- no way (the problem is marked --> PART A)
-->This does not work--> why ??? <--
=============================
<xsl:variable name="t_path">
<xsl:value-of select="element[@name='module_active/status']"/>
</xsl:variable>
<xsl:value-of select="element[@name='content_group']/$t_path/@readonly"/>
=============================
(you can find it in the complete source as well )
Does someone have any ideas. I think the solution might be simple,
but I cannot grab it at the moment
Thanks for your feedbacks
Jochen from Berlin
Sources:
========
Heres: xml:
<?xml version="1.0"?>
<module>
<element name="content_group">
<in_process readonly="readonly"/>
</element>
<element name="module_active/status">
<value>in_process</value>
</element>
</module>
Heres: xslt:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xhtml" version="1.0" encoding="UTF-8" indent="no"
omit-xml-declaration="yes" doctype-public="-//W3C/DTD XHTML 1.0
Transitional//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
standalone="yes" media-type="text/html" />
<xsl:template match="/module">
<xsl:variable name="t_path">
<xsl:value-of select="element[@name='module_active/status']"/>
</xsl:variable>
<br/>
this works:
<xsl:value-of
select="element[@name='content_group']/in_process/@readonly"/>
<!-- PART A - this is the part, I am frustrating about -->
this not (why?):
<xsl:value-of
select="element[@name='content_group']/$t_path/@readonly"/>
</xsl:template>
</xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list