Re: [xslt] string literal with single-quote inside won't parse



Viktor Stujber schrieb:
<xsl:value-of select="&quot;Hello, I'm a literal with an apostrophe inside.&quot;"/>

This is interesting... could you point me to the part of the spec that
describes the rules for constructing literals this way?

The XML parser turns the attribute value into:

  'Hello, I'm a literal with an apostrophe inside.'

And that's not a valid XPath 1.0 expression. So it's a bit awkward in
1.0, that's a fact. In 2.0, you can quote apostrophe or quote character
by doubling them.

  'Hello, I''m a literal with an apostrophe inside.'
  "Did you say ""apostrophe""?"

--
Michael Ludwig


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]