This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Storing xpath expressions in a vaiable
- To: xsl-list at mulberrytech dot com
- Subject: Storing xpath expressions in a vaiable
- From: Sridhar_Ramachandran at i2 dot com
- Date: Thu, 28 Sep 2000 14:43:24 -0700
- Reply-To: xsl-list at mulberrytech dot com
Hi,
I am trying to store an xpath expression in variable and trying to
evaluate it and storing the results in another variable. The xpath
expression used might depend on the value of some parameter(s) passed to
the style sheet. I am storing the xapth expression as follows :
<xsl:variable name="note_filter_expression">
<xsl:choose>
<xsl:when test="$filter_template">
<xsl:value-of select = "'//TABLE/NOTES[@TEMPLATE
=$filter_template]'"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'//TABLE/NOTES'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
In the above xsl code fragment, "filter_template" is a parameter passed to
the stylesheet. I would the like to evaluate the xpath expression stored in
$note_filter_expression and store the list of NOTES nodes returned in a
variable. I need a node-list instead of RTREEFRAG, for later processing. I
am using XALAN and it does not seem to provide a node-list() funtion like
xt/saxon. I tried
<xsl:variable name = "filtered_notes" select ='$note_filter_expression'/>
but this simply puts thestring representing the xpath expression into
$filtered_notes.
Any help is appreciated.
rgds
Sridhar
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list