W3C home > Mailing lists > Public > public-qt-comments@w3.org > June 2016

[Bug 29711] New: [XSLT30]Example: Merging Two Sequences of Numbers should use xsl:sequence instead of xsl:value-of

From: <bugzilla@jessica.w3.org>
Date: Tue, 28 Jun 2016 08:41:58 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-29711-523@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=29711

            Bug ID: 29711
           Summary: [XSLT30]Example: Merging Two Sequences of Numbers
                    should use xsl:sequence instead of xsl:value-of
           Product: XPath / XQuery / XSLT
           Version: Candidate Recommendation
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLT 3.0
          Assignee: mike@saxonica.com
          Reporter: martin.honnen@gmx.de
        QA Contact: public-qt-comments@w3.org
  Target Milestone: ---

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>

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Tuesday, 28 June 2016 08:42:13 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:58:01 UTC