[xsl] Attribute "separator" of xsl:value-of in XSLT 2.0

Subject: [xsl] Attribute "separator" of xsl:value-of in XSLT 2.0
From: Christian Rinderknecht <konchog.zangpo@xxxxxxxxx>
Date: Mon, 09 May 2011 19:48:14 +0900
Dear list members,

I have a beginner's question about the behaviour of the attribute
"separator" of the element xsl:value-of in XSLT 2.0.

The standard at section 11.4.3 states:

"If the separator attribute is present, then the effective value of
this attribute is used to separate adjacent items in the result
sequence, as described in 5.7.2 Constructing Simple Content. In the
absence of this attribute, the default separator is a single space
(#x20) when the content is specified using the select attribute, or a
zero-length string when the content is specified using a sequence
constructor."

The Big Book by Michael Kay (4th ed.), page 498--499 says:

"[...] <xsl:value-of select="author"/> [...] all the authors are now
output, using a single space as the default separator."

Let us say that I have a subtree like

<author>
  <first>Priscilla</first>
  <last>Walmsley</last>
</author>

Using Saxon HE 9-3-0-4j and assuming the current node is the parent of
author, the result of

<xsl:value-of select="author" separator=" "/>

or

<xsl:value-of select="author" separator="' '"/>

is the same as

<xsl:value-of select="author"/>

that is, 'PriscillaWalmsley'. But

<xsl:value-of select="author/first,author/last"/>

produces

'Priscilla Walmsley'.

Is this the semantics intended?

Best regards,

Christian

PS In case this is not a totally stupid question, here is my complete
example.

book.dtd is

<!ELEMENT book (author, chapter+)>
<!ATTLIST book title CDATA #REQUIRED>

<!ELEMENT author (first,last)>
<!ELEMENT first  (#PCDATA)>
<!ELEMENT last   (#PCDATA)>

<!ELEMENT chapter (section*)>
<!ATTLIST chapter title CDATA #REQUIRED>

<!ELEMENT section (section*)>
<!ATTLIST section title CDATA #REQUIRED>

num1.xml is

<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE book SYSTEM "book.dtd">

<book title="Definitive XML Schema">
<author>
  <first>Priscilla</first>
  <last>Walmsley</last>
</author>

<chapter title="A quick tour of XML Schema">
  <section title="An example schema"/>
  <section title="The components of XML Schema">
    <section title="Declarations vs. definitions"/>
	<section title="Global vs. local components"/>
  </section>
  <section title="Elements and attributes">
	<section title="The tag/type distinction"/>
  </section>
</chapter>

<chapter title="Instances and schemas">
  <section title="Using the instance attributes"/>
  <section title="Schema processing">
	<section title="Validation"/>
	<section title="Augmenting the instance"/>
  </section>
</chapter>

<chapter title="Conclusion"/>

</book>

num1.xsl is

<?xml version="1.0" encoding="UTF-8"?>

<xsl:transform version="2.0"
               xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
               xmlns:xhtml="http://www.w3.org/1999/xhtml";>

  <xsl:output method="xhtml"
              doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
              doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";
              indent="yes"
              omit-xml-declaration="yes"/>

  <xsl:template match="/">
    <xsl:apply-templates select="book"/>
    <xsl:text>&#10;</xsl:text>
  </xsl:template>

  <xsl:template match="book" as="element(xhtml:html)">
    <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
      <head>
        <title><xsl:value-of select="@title"/></title>
      </head>
      <body>
        <h2><xsl:value-of select="@title"/></h2>
        <p>by <xsl:value-of select="author"/></p>
        <h3>Table of contents</h3>
        <ul>
          <xsl:apply-templates select="chapter"/>
        </ul>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="section|chapter" as="element(xhtml:li)">
    <li xmlns="http://www.w3.org/1999/xhtml";>
      <xsl:value-of select="@title"/>
      <xsl:if test="not(empty(section))">
        <ul>
          <xsl:apply-templates select="section"/>
        </ul>
      </xsl:if>
    </li>
  </xsl:template>

</xsl:transform>

Current Thread