W3C home > Mailing lists > Public > public-qt-comments@w3.org > July 2002

RE: [saxon] Strange things: xsl:sort with lang attribute

From: Kay, Michael <Michael.Kay@softwareag.com>
Date: Fri, 19 Jul 2002 14:15:11 +0200
Message-ID: <DFF2AC9E3583D511A21F0008C7E621060453D9F2@daemsg02.software-ag.de>
To: Oliver Becker <obecker@informatik.hu-berlin.de>, saxon-help@lists.sourceforge.net, michael.h.kay@ntlworld.com
Cc: public-qt-comments@w3.org

> 
> > > BTW, which node is the context node in this expression? Is it foo 
> > > or foo's parent or maybe something completely different?
> > 
> > This isn't clearly stated in the XSLT 1.0 spec. But the
> only logical
> > node to use as the context node (and the one that Saxon
> uses) is the
> > same one that is used for evaluating the select expression in the
> > <xsl:for-each>.
> 
> Then please add something in the XSLT 2.0 spec. I couldn't
> find something at first go.

It's spelled out in 12.2 (April draft): <quote>Those attributes of the
xsl:sort elements whose values are attribute value templates are evaluated
using the outer focus. If the element that contains the xsl:sort elements is
an xsl:sort-key declaration, then the outer focus is a singleton focus based
on the document node of the principal source document. Otherwise, the outer
focus is the focus used to evaluate the select attribute of the containing
instruction (for example, xsl:for-each or xsl:apply-templates).</quote>

> 
> To my mind it is a little bit odd that in
> <xsl:sort select="expr1" lang="{expr2}" />
> expr1 and expr2 refer to different context nodes.

It is indeed a bit odd, but logical given that these attributes are
parameters to the sort operation as a whole, not things that can vary for
each sort key.

I will add this to my list as a candidate 1.0 erratum, though I'm not sure
if and when we'll get round to publishing further errata.

Michael Kay
Received on Friday, 19 July 2002 08:15:27 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:56:43 UTC