Subject: Re: [xsl] dynamic construction of path based on param From: Oleg Tkachenko <olegt@xxxxxxxxxxxxx> Date: Wed, 22 Jan 2003 20:18:22 +0200 |
A number of mistakes: local variable's scope is its parent element, so both of your variables go out of the scope immediately. Second - variables are not macros, <xsl:variable name="path" select="x510" /> means the variable is bound to *result* of evaluation of 'x510' xpath expression. And syllabus/$path is syntax error in XPath.I want to dynamically construct a path based on a param called $course. Here is my current code:
<xsl:if test='contains($course, "510")'> <xsl:variable name="path" select="x510" /> </xsl:if>
<xsl:if test='contains($course, "340")'> <xsl:variable name="path" select="x340" /> </xsl:if>
<xsl:apply-templates select='syllabus/$path'/>
<xsl:variable name="path"> <xsl:if test='contains($course, "510")'> <xsl:value-of select="x510" /> </xsl:if>
<xsl:if test='contains($course, "340")'> <xsl:value-of select="x340" /> </xsl:if> </xsl:variable>
<xsl:if test='contains($course, "510")'> <xsl:apply-templates select='syllabus/x510'/> </xsl:if> <xsl:if test='contains($course, "340")'> <xsl:apply-templates select='syllabus/x340'/> </xsl:if>
-- Oleg Tkachenko eXperanto team Multiconn Technologies, Israel
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] dynamic construction of path , raven | Thread | [xsl] how to match attributes in te, Alice Fan |
[xsl] dynamic construction of path , raven | Date | Re: [xsl] XSL/XML to Excel, Ronan Phelan |
Month |