W3C home > Mailing lists > Public > public-qt-comments@w3.org > August 2006

[Bug 3637] [XQuery] Adjacent text nodes

From: <bugzilla@wiggum.w3.org>
Date: Mon, 28 Aug 2006 08:57:01 +0000
To: public-qt-comments@w3.org
Message-Id: <E1GHcvV-0005Fl-3u@wiggum.w3.org>


           Summary: [XQuery] Adjacent text nodes
           Product: XPath / XQuery / XSLT
           Version: Candidate Recommendation
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery
        AssignedTo: chamberl@almaden.ibm.com
        ReportedBy: mike@saxonica.com
         QAContact: public-qt-comments@w3.org

XDM states in 6.7.1: "In addition, Document and Element Nodes impose the
constraint that two consecutive Text Nodes can never occur as adjacent
siblings. When a Document or Element Node is constructed, Text Nodes that would
be adjacent must be combined into a single Text Node. "

At first sight XQuery (Content of an element constructor) rule 2
appears to be restating this:

"2. Adjacent text nodes in the content sequence are merged into a single text
node by concatenating their contents, with no intervening blanks. After
concatenation, any text node whose content is a zero-length string is deleted
from the content sequence."

However, this is followed by rule 3 which says: "If the content sequence
contains a document node, the document node is replaced in the content sequence
by its children."

Replacing the document node by its children may produce text nodes, which may
then be adjacent to other text nodes that have already been merged under rule
2. So we have to rely on the statement in the data model to know that these
text nodes now have to be merged with adjacent text nodes, in other words we
have to repeat the process described in rule 2.

It would be clearer if rule 3 came before rule 2: that is, replace a document
node by its children, then merge adjacent text nodes, then remove zero-length
text nodes. I believe that when you read the XQuery rules alongside the XDM
rules, this is what has to happen anyway.

Document nodes with text node children don't actually arise much in XQuery
(unlike XSLT) but they are still possible.
Received on Monday, 28 August 2006 08:57:30 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:13 UTC