<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi Roger,</p>
<p>I see you also started a discussion on the xml dev list:</p>
<p><a class="moz-txt-link-freetext" href="http://lists.xml.org/archives/xml-dev/202202/msg00016.html">http://lists.xml.org/archives/xml-dev/202202/msg00016.html</a></p>
<p>Oxygen uses the Saxon XSLT processor to run the XPath but it
creates a nodes structure using the Xerces parser which various
features set to it so running an XPath in Oxygen is most of the
times similar to running it inside an XSLT stylesheet (most of the
times).</p>
<p>1) About the first example, two text nodes separated by an XML
comment.</p>
<p>
<blockquote type="cite"><root><br>
abc<!-- aaa -->def<br>
</root><br>
</blockquote>
even running an XSLT stylesheet returns two text nodes:</p>
<p>
<blockquote type="cite"><xsl:stylesheet
xmlns:xsl=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/1999/XSL/Transform">"http://www.w3.org/1999/XSL/Transform"</a><br>
xmlns:xs=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema">"http://www.w3.org/2001/XMLSchema"</a><br>
exclude-result-prefixes="xs"<br>
version="2.0"><br>
<xsl:template match="root"><br>
<xsl:message>cnt <xsl:value-of
select="count(text())"/></xsl:message><br>
</xsl:template><br>
</xsl:stylesheet></blockquote>
So our XPath results are similar with the XSLT stylesheet's. <br>
</p>
<p>The XPath is a sequence of two text nodes. To always return one
node, I would probably use this XPath "/root/string-join(text(),
'')" instead.</p>
<p>2) About the text and cdata example:</p>
<p>
<blockquote type="cite"><root><br>
abc<![CDATA[cdata]]>def<br>
</root><br>
</blockquote>
Indeed the same XSLT stylesheet returns a single text node, so in
this case our XPath evaluation (which returns 3 separate notes) is
different than how the Xpath would be evaluated inside an XSLT
engine. Probably it's different because to run the XPath and be
able to precisely localize the nodes we create the nodes structure
instead of delegating the creation to the Saxon XSLT Processor.
And in that nodes structure there is a separate node for cdata.<br>
</p>
<p>Regards,</p>
<p>Radu</p>
<pre class="moz-signature" cols="72">Radu Coravu
Oxygen XML Editor</pre>
<div class="moz-cite-prefix">On 2/10/22 00:53, Roger L Costello
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:SA9PR09MB5952AAAEF43EF2D65F8BCA45C82E9@SA9PR09MB5952.namprd09.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
<style>@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"Plain Text Char";
margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}span.PlainTextChar
{mso-style-name:"Plain Text Char";
mso-style-priority:99;
mso-style-link:"Plain Text";
font-family:"Calibri",sans-serif;}.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}div.WordSection1
{page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoPlainText">Hello Oxygen Team,<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">The XPath evaluator returns a series of
text nodes for a leaf element containing a comment or a CDATA
section. That is not correct. The content is a single text
node.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">Here is a <Test> element whose
content is some text, a comment, and more text. The XPath
evaluator for /Test/text() returns 2 items, which is not
correct. The content of <Test> is a single text node
containing all of the text concatenated.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><img
style="width:7.7208in;height:5.3333in" id="Picture_x0020_5"
src="cid:part1.ApslyoVQ.DpLHI5X3@oxygenxml.com" class=""
width="741" height="512"><o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText">The XPath evaluator erroneously returns
3 items when <Test> contains a CDATA section. Further,
there is no such thing as cdata-section node.<o:p></o:p></p>
<p class="MsoPlainText"><o:p> </o:p></p>
<p class="MsoPlainText"><img
style="width:9.2083in;height:5.5875in" id="Picture_x0020_4"
src="cid:part2.LSfYfQ0v.IkNOfook@oxygenxml.com" class=""
width="884" height="536"><o:p></o:p></p>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
oXygen-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:oXygen-user@oxygenxml.com">oXygen-user@oxygenxml.com</a>
<a class="moz-txt-link-freetext" href="https://www.oxygenxml.com/mailman/listinfo/oxygen-user">https://www.oxygenxml.com/mailman/listinfo/oxygen-user</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">
</pre>
</body>
</html>