xsl-list
[Top] [All Lists]

Re: [xsl] Can't have both " and ' in an XPath literal

2006-04-22 18:18:54
At 2006-04-23 02:27 +0200, rolf(_at_)pointsman(_dot_)de wrote:
As far as I see, there is no way to have both ' (') and " (")
in one XPath literal.

Correct ... but literal operands can be constructed easily enough.

Example:

(copied and modified below)

But as far as I see, there is no way in XPath 1.0 to write a
predicate, which selects such values, because it is not possible to
write an XPath literal which includes both of the possible delimiter
characters of an XPath literal. (A similar example could be easily
constructed for text content of an element.)

To all of my knowledge, the XPath 1.0 syntax has no escaping mechanism
for literal delimiters at all.

Do I miss something?

How about the following?

I hope this helps.

. . . . . . Ken

T:\ftemp>type rolf.xml
<doc>
  <e att="foo">foo</e>
  <e att="a&apos;&quot;b">bar</e>
  <e att="grill">grill</e>
</doc>

T:\ftemp>type rolf.xsl
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

  <xsl:template match="doc">
    <xsl:for-each select="e[(_at_)att=concat(&quot;a'&quot;,'&quot;b')]">
      <xsl:value-of select="."/>
    </xsl:for-each>
  </xsl:template>

</xsl:stylesheet>

T:\ftemp>xslt rolf.xml rolf.xsl con
<?xml version="1.0" encoding="utf-8"?>bar
T:\ftemp>


--
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(_at_)CraneSoftwrights(_dot_)com
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


--~------------------------------------------------------------------
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>
--~--