This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 29711 - [XSLT30]Example: Merging Two Sequences of Numbers should use xsl:sequence instead of xsl:value-of
Summary: [XSLT30]Example: Merging Two Sequences of Numbers should use xsl:sequence ins...
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Candidate Recommendation
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-28 08:41 UTC by Martin Honnen
Modified: 2016-10-06 18:42 UTC (History)
0 users

See Also:


Attachments

Description Martin Honnen 2016-06-28 08:41:58 UTC
The second example in https://www.w3.org/TR/xslt-30/#merge-examples is supposed "to determine the union ... of two sequences of numbers (or other atomic values)" and looks like this:

<xsl:merge>
  <xsl:merge-source select="1 to 30">
      <xsl:merge-key select="."/>
  </xsl:merge-source>
  <xsl:merge-source select="20 to 40">
      <xsl:merge-key select="."/>
  </xsl:merge-source>
  <xsl:merge-action>
    <xsl:value-of select="current-merge-key()"/>
  </xsl:merge-action>
</xsl:merge>

I think it would be better use xsl:sequence instead of xsl:value-of, as in

<xsl:merge>
  <xsl:merge-source select="1 to 30">
      <xsl:merge-key select="."/>
  </xsl:merge-source>
  <xsl:merge-source select="20 to 40">
      <xsl:merge-key select="."/>
  </xsl:merge-source>
  <xsl:merge-action>
    <xsl:sequence select="current-merge-key()"/>
  </xsl:merge-action>
</xsl:merge>

as the latter gives a sequence of xs:integer values being merged while the former gives a sequence of text nodes with the integer values.

The third example computing the intersection with 

<xsl:merge>
  <xsl:merge-source select="1 to 30">
      <xsl:merge-key select="."/>
  </xsl:merge-source>
  <xsl:merge-source select="20 to 40">
      <xsl:merge-key select="."/>
  </xsl:merge-source>
  <xsl:merge-action>
    <xsl:if test="count(current-merge-group()) eq 2">
      <xsl:value-of select="current-merge-key()"/>
    </xsl:if>
  </xsl:merge-action>
</xsl:merge>

has the same flaw, it should use


<xsl:merge>
  <xsl:merge-source select="1 to 30">
      <xsl:merge-key select="."/>
  </xsl:merge-source>
  <xsl:merge-source select="20 to 40">
      <xsl:merge-key select="."/>
  </xsl:merge-source>
  <xsl:merge-action>
    <xsl:if test="count(current-merge-group()) eq 2">
      <xsl:sequence select="current-merge-key()"/>
    </xsl:if>
  </xsl:merge-action>
</xsl:merge>
Comment 1 Michael Kay 2016-06-30 20:56:07 UTC
Thanks.

The WG agrees, and I have made the changes.