W3C home > Mailing lists > Public > public-qt-comments@w3.org > March 2004

RE: [XSLT 2.0] Extra parameter for key()

From: Michael Kay <mhk@mhk.me.uk>
Date: Wed, 24 Mar 2004 16:00:17 -0000
To: "'David Carlisle'" <davidc@nag.co.uk>, <dnovatchev@yahoo.com>
Cc: <public-qt-comments@w3.org>
Message-Id: <20040324160109.8223716D73@w3c2.w3.org>

# I agree with Dimitre that xsl:key and xsl:id should have the 
# same argument forms but I do question why this is needed (for 
# id() or key()) It is true that the XSLT1 for-each hack was 
# horrible but given that the
# XPath2 versions allow id() to be used within a path 
# expression and index the document current at that point, what 
# is gained by the new syntax. Isn't id("a",$somedocumentnode) 
# the same as $somedocumentnode/id("a") in the case when 
# $somedocumentnode is a single document node (and perhaps also 
# when it is not?)

It's almost the same. There are probably two reasonable justifications for
the extra argument

(a) the $doc/id(@x) approach isn't obvious to the average beginner

(b) the above changes the context node for "@x" which means you need to
introduce a variable to follow cross-document references.

I'm not personally overwhelmed by the weight of these arguments but I can
live with them.

Michael Kay
Received on Wednesday, 24 March 2004 16:51:34 UTC

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