[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Evaluate string as XPATH axis in XSLT1.0?
Great thanks, as I'm using the EXSLT library elsewhere in the transform
I found the dyn:evaluate() function. The problem now is my XPATH string
contains apostrophes which I can't seem to escape adequately for
dyn:evaluate() to not throw errors.
The string is of the form: ./foo[@type = 'bar'] I've tried the following XSLT char escaping options expressions: [One] <xsl:variable name="testmap" select="dyn:evaluate('./foo[@type = 'bar']')"/> Result: Error = "expected ")", found "<name>" [Two] <xsl:variable name="testmap" select="dyn:evaluate('./foo[@type = 'bar']')"/> Result: Error = "expected ")", found "<name>" [Three] <xsl:variable name="testmap" select="dyn:evaluate('./foo[@type = \\'bar\\']')"/> Result: Error = "expected ")", found "<name>" [Four] <xsl:variable name="x">'</xsl:variable> <xsl:variable name="testmap" select="dyn:evaluate(concat('./foo[@type = ',$x, 'bar',$x,']'))"/> Result: Parses OK but value is empty. If I reference this path directly without using evaluate, the correct node-set is returned. It seems like dyn:evaluate isn't handling embedded apostrophes but I couldn't Google any workarounds for it. Matt Michael Kay wrote: There's no standard way to construct an XPath expression from a string at
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|