| Subject: [xsl] Problem with using $variable in xsl:value-of From: "Jochen Metzger" <j.metzger@xxxxxxxxxxxx> Date: Wed, 18 Sep 2002 20:42:18 +0200 | 
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
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| RE: [xsl] RE: XML/XSLT to HTML outp, Passin,Thomas B. (To | Thread | Re: [xsl] Problem with using $varia, David Carlisle | 
| RE: [xsl] Limiting a FOR-EACH loop, Gurnam Bedi | Date | RE: [xsl] Limiting a FOR-EACH loop, Wes Kubo | 
| Month |