Reputation: 73
Ill much appreciate if any one can help me in finding a way to read a text as xpath expression
e.g. this is my xml document
<abc>
<XYZ>
<include>/citizen[./marital_status[text() ='married']]</include>
</XYZ>
</abc>
and I am writing a stylesheet
<xsl:template match="abc">
<xsl:call-template name="evaluate">
<xsl:with-param name="include">
<xsl:apply-templates select="$include"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
The problem here is that the text of <include>
element here is something i want to be an xpath expression in <xsl:apply-templates select="$include"/>
. this will give me citizens who are married but here i just get the string "/citizen[./marital_status[text() ='married']]"
itself as a result. Is there anypossible way of doing it ?
thanks in advance
Upvotes: 1
Views: 150
Reputation: 163262
Check what's available in your chosen XSLT processor: see if it has some kind of xx:evaluate() extension function. If not, or if you want a portable solution, the alternative is to generate a stylesheet (or stylesheet module) containing the relevant expression, and then compile and execute the stylesheet.
Upvotes: 1