xsl-list
[Top] [All Lists]

RE: [xsl] text nodes not merged

2006-09-14 08:23:12
You quote:

According to http://www.w3.org/TR/xslt20/#constructing-complex-content
(point 6 in the list there)

But you need to read the first paragraph of the section:

This section describes how the sequence obtained by evaluating a sequence
constructor may be used to construct the children of a newly constructed
document node, or the children, attributes and namespaces of a newly
constructed element node. The sequence of items may be obtained by
evaluating the sequence constructor contained in an instruction such as
xsl:copy, xsl:element, xsl:document, xsl:result-document, or a literal
result element.

So if you use the sequence returned by the function to construct the content
of an element, then adjacent text nodes will be merged. But if you don't
(for example if you do an xsl:for-each over the items in the sequence), then
they won't.

Michael Kay
http://www.saxonica.com/


-----Original Message-----
From: Wolfgang Jeltsch [mailto:wolfgang(_at_)jeltsch(_dot_)net] 
Sent: 14 September 2006 16:13
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] text nodes not merged

Hello,

please consider this stylesheet:

      <?xml version="1.0"?>
      <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
              xmlns:example="http://www.example.com/";
              version="2.0">
        <xsl:function name="example:double-text">
          <xsl:param name="node"/>
          <xsl:value-of select="$node"/>
          <xsl:text>#</xsl:text>
        </xsl:function>
        <xsl:template match="/">
          <hello>
            <xsl:for-each select="example:double-text(/)">
              <hi>
                <xsl:value-of select="."/>
              </hi>
            </xsl:for-each>
          </hello>
        </xsl:template>
      </xsl:stylesheet>

According to http://www.w3.org/TR/xslt20/#constructing-complex-content
(point 6 in the list there), the two text nodes created by 
the function's sequence constructor should be merged, as far 
as I can see.  However, they aren't which is shown by the 
fact that the stylesheet outputs two hi elements instead of 
one.  What's wrong here?

By the way, I use the open-source edition of Saxon 8.7.3J on 
Debian GNU/Linux 3.1.

Best wishes,
Wolfgang

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



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

<Prev in Thread] Current Thread [Next in Thread>