|
Subject: RE: quoting of special characters within XPath string From: "Julian Reschke" <reschke@xxxxxxxxxxxxxxxxxxxxx> Date: Wed, 5 Apr 2000 19:20:08 +0200 |
>> I can not guarantee that variableString does not contain single or double
>> quotes. It might even contain both kinds of quotes. How do I have to
escape
>> (?) those quotes to get a well-formed XPath string?
>
>there are some examples of this in the archive, but...
>
>First just consider the xpath syntax.
>
>You can use " or ' to delimit a string literal, so if you only want one
>then you can delimit with the other.
> "'" or '"'
>if you want both then you can not do it directly in a string literal but
>you can construct the string '" using
>translate('a"','a',"'")
>or
>concat("'",'"')
>or if you drop out of xpath, to xslt
><xsl:variable name="x">'"</xsl:variable>
>then use $x as this result tree fragment will coerce to a string.
Yes, it seems that the code can use ' or " and only fallback to concat() if
both types of quotes appear in the variable...
> I was thinkin about something like
>
> selectNodesParametrized (node, "/element[@attr ='$$']", variableString);
>
>isn't that just
>
>select="/element[@attr = $variableString]" ?
>
>or perhaps I didn't understand the question.
That might work in a stylesheet, but I don't think that the selectNodes()
method in the MSXML DOM has any notion of variables... How could it?
Thanks for the feedback,
Julian
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: quoting of special characters w, David Carlisle | Thread | Comparing dates/times within an XSL, Lalit Jalota |
| XSL FO conformance, Sebastian Rahtz | Date | Style sheet for adopersistxml recor, Moazzam Ahmed |
| Month |