Subject: Re: [xsl] Can't have both " and ' in an XPath literal From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Sun, 23 Apr 2006 09:29:42 -0400 |
Thanks for answering Ken, but ...
On 22 Apr, G. Ken Holman wrote: ... > <xsl:for-each select="e[@att=concat("a'",'"b')]"> ... Nice workaround for the my example. But as I wrote, that example is not the real problem. I provided it only to illustrate the underlying problem, I see with the XPath syntax.
The question (or problem) is not (only) an XSLT one, but more an XPath problem.
Imagine a script language (in fact, that's the real scenario), which got a DOM tree and is able to execute XPath expressions on that tree. Now, the programmer want to select the elements with an attribute x with an attribute value given by outside (say: user input).
If you want to programmatically create the needed XPath expr (simplified something like: e[@x='<that random value comming from elsewhere, you've no control over>'])
then the question arises how to escape the XPath literal delimiter character in that string.
<xsl:variable name="val">that random value comming from elsewhere, you've no control over (except for escaping the embedded markup charactes)</xsl:variable>
There is no way to escape the XPath literal delimiter character within a literal with the XPath syntax rules, as you confirm. OK, in the scribbled case, the programmer could write a complex parsing rule, to rewrite the wanted expression along the line you showed, but that is, to word tempered, tedious.
-- Registration open for XSLT/XSL-FO training: Wash.,DC 2006-06-12/16 Also for XSLT/XSL-FO training: Minneapolis, MN 2006-07-31/08-04 Also for XML/XSLT/XSL-FO training:Birmingham,England 2006-05-22/25 Also for XSLT/XSL-FO training: Copenhagen,Denmark 2006-05-08/11 World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Aug'05 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Can't have both " an, rolf | Thread | RE: [xsl] Can't have both " an, Michael Kay |
RE: [xsl] Can't have both " an, Michael Kay | Date | [xsl] exclude-result-prefixes, Arulraj |
Month |