0

I find difficulty in converting string to xpath in xslt

XSLT

 <xsl:param name="name"/>

 <xsl:template match="/">
    <xsl:if test="$name">
      <xsl:message><xsl:value-of select="$name"/></xsl:message>
      <xsl:value-of select="$name"/>
    </xsl:if>
  </xsl:template>

param 'name' value (Xpath expression) will be passed from java. What should i do in xsl to consider this string as xpath?

1 Answer 1

2

What you're asking for is something akin to the eval function of languages such as Perl, to treat a string as an expression in the language. This is not something that XSLT 1.0 or 2.0 provides natively, though many processors provide support through extension functions such as EXSLT. The current XSLT 3.0 working draft provides a similar mechanism, which is supported by Saxon.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.