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

[Bug 13494] New: Node uniqueness returned from XSLT function.

From: <bugzilla@jessica.w3.org>
Date: Mon, 01 Aug 2011 08:45:31 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-13494-523@http.www.w3.org/Bugs/Public/>

           Summary: Node uniqueness returned from XSLT function.
           Product: XPath / XQuery / XSLT
           Version: 2nd Edition Recommendation
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLT 2.0
        AssignedTo: mike@saxonica.com
        ReportedBy: vladimir@nesterovsky-bros.com
         QAContact: public-qt-comments@w3.org

Running my XSLT with the Saxon engine, I've found some ambiguity as for
implementation details of node uniquess returned from a function. That's an

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" 
  exclude-result-prefixes="t xs">

  <xsl:template match="/" name="main">
    <xsl:variable name="result">
        <xsl:for-each select="1 to 3">
          <section-ref name-ref="{t:generate-id()}.s"/>

          <xsl:variable name="id" as="xs:string" select="t:generate-id()"/>
          <section-ref name-ref="{$id}.s"/>

    <xsl:message select="$result"/>

  <!-- This is siplified version. -->
  <xsl:function name="t:generate-id" as="xs:string">
    <xsl:variable name="element" as="element()">

    <xsl:sequence select="generate-id($element)"/>

  <!-- This is more complex version. See spec section 9.2 -->
  <xsl:function name="t:generate-id" as="xs:string">
    <xsl:call-template name="t:generate-id"/> 

  <xsl:template name="t:generate-id" as="xs:string">
    <xsl:param name="name" as="xs:string" select="'a'"/>
    <xsl:param name="element" as="element()">
      <xsl:element name="{$name}"/>

    <xsl:sequence select="generate-id($element)"/>

I thought that the stylesheet should output elements with different values of
name-ref attribute.

Unfortunately, Saxon behaves differently depending on how I write the code:

a) following produces same values:

   <section-ref name-ref="{t:generate-id()}.s"/>

b) this produces different values:

   <xsl:variable name="id" as="xs:string" select="t:generate-id()"/>
   <section-ref name-ref="{$id}.s"/>

In the course of discussion with Michael Kay he pointed that the behaviour is
not strictly defined in the spec, so that's not an implementation bug.

I would like WG to clarify this behaviour.

Originally problem described at:


Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Monday, 1 August 2011 08:45:32 UTC

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