W3C home > Mailing lists > Public > public-qt-comments@w3.org > December 2006

RE: [XSLT2] xsl:number difference in XSLT2 and XSLT1 when using from

From: Michael Kay <mhk@mhk.me.uk>
Date: Thu, 7 Dec 2006 19:20:01 -0000
To: "'Botond Biro'" <botond.biro@altova.com>, <public-qt-comments@w3.org>
Message-ID: <018101c71a34$b286f8c0$4c10000a@turtle>
Thanks for the comment.
 
Personal response: It's really difficult to work out what XSLT 1.0 intends
to happen in corner cases. I've spent many hours studying the exact words,
and the only conclusion I can come to is that they don't make sense if taken
literally. In particular, I think one needs to read the paragraph as a
whole:
 
When level="single", it goes up to the first node in the ancestor-or-self
axis that matches the count pattern, and constructs a list of length one
containing one plus the number of preceding siblings of that ancestor that
match the count pattern. If there is no such ancestor, it constructs an
empty list. If the from attribute is specified, then the only ancestors that
are searched are those that are descendants of the nearest ancestor that
matches the from pattern. Preceding siblings has the same meaning here as
with the preceding-sibling axis.
 
Note here the switch from "node in the ancestor-or-self axis" to "preceding
siblings of that ancestor" and "no such ancestor". It seems clear that these
two references to "ancestor" should be read as "ancestor-or-self". This then
suggests that "only ancestors" and "nearest ancestor" should be read as
"only ancestors-or-self" and "nearest ancestor-or-self"; and having fixed
those problems, one then has to ask whether "descendants" should also be
read as "descendants-or-self".
 
I'm not suggesting that your reading of the 1.0 spec here is incorrect, only
that many different readings of it are possible. Faced with that situation,
we tried to focus on defining rules for 2.0 that were unambiguous, hopefully
reasonably intuitive, and backwards compatible in the cases that mattered.
 
Michael Kay


  _____  

From: public-qt-comments-request@w3.org
[mailto:public-qt-comments-request@w3.org] On Behalf Of Botond Biro
Sent: 06 December 2006 10:23
To: public-qt-comments@w3.org
Subject: [XSLT2] xsl:number difference in XSLT2 and XSLT1 when using from



Hi, 

If I understand correctly, there is a difference in XSLT2 and XSLT1 when
using xsl:number with the from and count attributes specified. (
level=single|nultiple )

XSLT1: 
If the from attribute is specified, then the only ancestors that are
searched are those that are descendants of the nearest ancestor that matches
the from pattern. 

XSLT2: 
$AF ::= $A[ancestor-or-self::node()[. is $F]] this will mean that ancestors
that are descendants-or-self of the innermost from matching node are
searched. 

If the first node matching the count pattern is the same with the one
selected by the from expression, XSLT1 will return the empty sequence, XSLT2
will return the node.

I think this should be mentioned in the XSLT1 difference list and clarified
how this should be handled when backwards compatibility mode is enabled. Or
if this difference isn't intentional then the $AF construction should be
corrected to $A[ancestor::node()[. is $F]].


Best regards, 
Botond 


... Botond Biró
.... Software Engineer
.... Altova GmbH

===================================================================
AltovaŽ  accelerates  application development  and  data management
projects with  software  and  solutions  that enhance  productivity
and maximize results. Uncover why Altova is the preferred choice of
over 2.5 million users worldwide!  Look into   <file://www.altova.com>
www.altova.com today!
===================================================================

Altova,  XMLSpy, MapForce, StyleVision, SemanticWorks, SchemaAgent,
UModel,  DiffDog,  DatabaseSpy, AltovaXML, and Authentic are trade-
marks  and/or registered  trademarks  of  Altova GmbH in the United
States of America, the European Union and numerous other countries.
The information transmitted in this message and/or as an attachment
to it  is intended  only for the  person or  entity to  which it is
addressed and may contain confidential  and/or privileged material.
Any  review,  retransmission,  dissemination  or  other use of,  or
taking of any action in reliance upon,  this information by persons
or entities other than the intended recipient is prohibited. If you
received this in error,  please contact  the sender  and delete the
material from any computer.  Altova GmbH  and  Altova, Inc.  do not
accept legal responsibility  for the contents of this message.  Any
views or opinions  presented are solely  those of the author and do
not  necessarily  represent those of  Altova GmbH and  Altova, Inc.
unless otherwise specifically stated. Thank you! 
Received on Thursday, 7 December 2006 19:20:15 UTC

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