Subject: RE: [xsl] giving key() a context (changes between XSLT 1.0 and 2.0) From: "Michael Kay" <mhk@xxxxxxxxx> Date: Fri, 3 Sep 2004 08:54:28 +0100 |
> ... > <xsl:variable name='auth' select='$biogs/key("biog", $name)'/> > ... > > </xsl:template> > > That is, key() is used directly in the expression, and has its > context supplied by the previous expression step. Assuming I'm > understanding all this correctly, then I like this approach more than > the three arg key() call, because it seems to fit better with > typical XSLT usage patterns. There is actually one use case where the 3-argument approach is much more convenient, namely when the second argument is a node in a different document from the one you want to search: select="key('k', @code, document('codes.xml'))" > > The above, however, didn't work in my XSLT 1.0 processor. No > surprise, I guess. No need for the for-each hack if you could do > that. But I've been looking around for a succint explaination of > what exactly changed in XSLT 2.0 to make this possible, and I haven't > been able to find it yet. The change was actually in XPath 2.0, which now allows any expression on the rhs of the "/" operator. XPath 1.0 restricted this to be an axis step. > > So I guess my questions are: > > * is it true that the above ($biogs/key( ...)) really is illegal in > XSLT 1.0? Yes. > > * what restriction was relaxed to make this possible in XSLT 2.0? > See above. Michael Kay
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] giving key() a context (chang, Joseph Dane | Thread | Re: [xsl] giving key() a context (c, David Carlisle |
RE: [xsl] Check for text between t, Michael Kay | Date | RE: [xsl] for-each loop in node set, Michael Kay |
Month |