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

[Bug 7356] New: Need clarification in the definition of circularity

From: <bugzilla@wiggum.w3.org>
Date: Mon, 17 Aug 2009 21:25:59 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-7356-523@http.www.w3.org/Bugs/Public/>
http://www.w3.org/Bugs/Public/show_bug.cgi?id=7356

           Summary: Need clarification in the definition of circularity
           Product: XPath / XQuery / XSLT
           Version: Recommendation
          Platform: All
               URL: http://www.w3.org/TR/xslt20/#dt-circularity
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: XSLT 2.0
        AssignedTo: mike@saxonica.com
        ReportedBy: zongaro@ca.ibm.com
         QAContact: public-qt-comments@w3.org


The definition of circularity in XSLT 2.0[1] is "A circularity is said to exist
if a construct such as a global variable, an attribute set, or a key is defined
in terms of itself. For example, if the expression or sequence constructor 
specifying the value of a global variable X references a global variable Y,
then the value for Y must be computed before the value of X. A circularity
exists if it is impossible to do this for all global variable definitions."

The error reported for a circularity is "[ERR XTDE0640] In general, a
circularity in a stylesheet is a non-recoverable dynamic error. However, as
with all other dynamic errors, an implementation will signal the error only if
it actually executes the instructions and expressions that participate in the
circularity."

It's not clear from the definition or the examples whether circularity is a
static property of a variable or key, or it is something that is dynamic. 
Consider the following example:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
  <xsl:param name="p" as="xs:boolean"/>
  <xsl:variable name="x" select="if $p then $y+1 else 17"/>
  <xsl:variable name="y" select="if $p then 19 else $x"/>

  <xsl:template match="/">
    <out><xsl:sequence select="$x, $y"/></out>
  </xsl:template>
</xsl:stylesheet>

In this example, there is a variable reference for x in the expression used to
define y, and a variable reference for y in the expression used to define x. 
If these are "references" for the purposes of the definition of circularity,
then x must be computed before y, and y before x, and so there is a
circularity.

However, if a reference for the purposes of circularity means a reference that
is actually evaluated, then there is no circularity - if p has the value true,
the definition of x has a reference to y, but the definition of y does not have
a reference to x, so y must be evaluated before x if p is true; if p has the
value false, the definition of y has a reference to x, but the definition of x
does not have a reference to y, so x must be evaluated before y if p is false.

[1] http://www.w3.org/TR/xslt20/#dt-circularity


-- 
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, 17 August 2009 21:26:09 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:40 UTC