- From: <bugzilla@jessica.w3.org>
- Date: Mon, 01 Aug 2011 08:45:31 +0000
- To: public-qt-comments@w3.org
http://www.w3.org/Bugs/Public/show_bug.cgi?id=13494
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
example:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:t="http://www.nesterovsky-bros.com/xslt/public"
exclude-result-prefixes="t xs">
<xsl:template match="/" name="main">
<xsl:variable name="result">
<root>
<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:for-each>
</root>
</xsl:variable>
<xsl:message select="$result"/>
</xsl:template>
<!-- This is siplified version. -->
<!--
<xsl:function name="t:generate-id" as="xs:string">
<xsl:variable name="element" as="element()">
<element/>
</xsl:variable>
<xsl:sequence select="generate-id($element)"/>
</xsl:function>
-->
<!-- 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:function>
<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:param>
<xsl:sequence select="generate-id($element)"/>
</xsl:template>
</xsl:stylesheet>
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:
http://sourceforge.net/projects/saxon/forums/forum/94027/topic/4621860
Thanks.
--
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