Re: Text(): Unifying DOM/Infoset/XPath/XSL

References:
<http://lists.w3.org/Archives/Public/www-xpath-comments/1999JulSep/0028.html>

Since the XML Infoset recognizes that distinguishing CDATA sections in the
midst of text is useful, I'd like the XPath spec to do the same.

In the context of CDATA sections, I concur with Paul Prescod's concerns,
though I disagree with the details of his proposed model.

It concerns me that the following three XML fragments are considered
equivalent to XPath:

<code>if (<![CDATA[a < b && b < c]]>) run();</code>

<code>if (a <![CDATA[<]]> b <![CDATA[&&]]> b <![CDATA[<]]> c) run();</code>

<code>if (a &lt; b &amp;&amp; b &lt; c) run();</code>

In all cases, the path "code/text()[1]" yields "if (a < b && b < c) run();". 

Fortunately for me, the DOM models each of these three cases differently,
allowing me to distinguisch CDATA sections.  It's unfortunate that I have to
normalize-out this distinction when implementing XPath, not to mention
denying my API clients the capability of addressing CDATA sections with an
XPath.

I don't think we need to descend all the way to a least common denominator
character span model, though.  Some amount of normalization should be
required by XPath in order to guarantee that paths are unambiguous. 
Unfortuately, I think the current normalization of CDATA sections is too
much of a good thing.

Perry

Received on Friday, 13 August 1999 16:30:18 UTC