xsl-list
[Top] [All Lists]

[xsl] How to select for ' in XPATH?

2009-08-05 13:05:14

Hello,

I tried to select for special characters with XPATH below.
While I succeeded for some I am unable to select for the
' character (') and got an error message.

Any hint how this can be done?

$ xmlsh
$ cat tst.html
<html><body>
<p>lt and gt: &lt; &gt; </p>
<p>apos and quot: &apos; &quot; </p>
</body></html>
$ tidy -q -xml tst.html;
<html>
  <body>
    <p>lt and gt: &lt; &gt;</p>
    <p>apos and quot: ' "</p>
  </body>
</html>

$ xpath "/*/*/*[contains(normalize-space(.),'<')]" <tst.html
<p>lt and gt: &lt; &gt; </p>
$ xpath "/*/*/*[contains(normalize-space(.),'>')]" <tst.html
<p>lt and gt: &lt; &gt; </p>
$ xpath "/*/*/*[contains(normalize-space(.),'\"')]" <tst.html
<p>apos and quot: ' " </p>
$ xpath "/*/*/*[contains(normalize-space(.),'\'')]" <tst.html
Exception running: xpath
net.sf.saxon.s9api.SaxonApiException: XPath syntax error at char 34 in
{...ontains(normalize-space(.),...}:
    Unmatched quote in expression
$


Mit besten Gruessen / Best wishes,

Hermann Stamm-Wilbrandt
Developer, XML Compiler
WebSphere DataPower SOA Appliances
----------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Erich Baier
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--