[EMAIL PROTECTED] wrote:
>
> Stephen Cranefield ([EMAIL PROTECTED]) writes:
> >Does Xalan-Java apply keys to additional source documents loaded using
> >the document() function?
> >In an article at
> >
> http://www-106.ibm.com/developerworks/library/ws-trans/index.html?dwzone=ws
> ,
> >Uche Ogbuji states that "every time an additional source document is
> >loaded with the XSLT document() function, all keys are applied to it
> >as well".
>
> I think Uche might be going out on a limb with that statement. I don't
> believe that the spec says that merely calling document() is sufficient
> to cause the scan for "use" nodes in a key.
It depends on what your definition of "applied" is.
The intent behind my comment is that keys do apply to added documents.
I didn't mean to make any determination of *when* they are computed.
> You may have to actually
> select a node that matches the "use" pattern for it to be detected.
Sure. I don't think this meaningfully contradicts me.
> I presume that you read the keying-other-documents stuff at the end of
> Section 12.2 of the XSLT spec. It shows use of keys on other documents,
> but relies on xsl:for-each to switch the current node list. This is
> reinforced by the sneaky phrase in the first paragraph under the key()
> function that says "it returns a node-set containing nodes in the same
> document as the context node...." You might not be invoking key() at a
> place where the current/context node is inside the reserved_words.xml
> file.
>
> We may have a bug in this area, but I can't tell from what you sent.
> At the time key() is invoked, the context node must be set to a node
> in the document you want to search, as key() is only going to search
> that one document. Your question has made me think of some tricky
> non-mainstream test cases!
The "only use matched nodes in same doc as the context" bug is one I
also had to fix in 4XSLT back then. You might want to try my code from
the article cited to check whether Xalan complies. Saxon does agree
with 4XSLT, and the spec, on this.
--
Uche Ogbuji Principal Consultant
[EMAIL PROTECTED] +1 303 583 9900 x 101
Fourthought, Inc. http://Fourthought.com
4735 East Walnut St, Boulder, CO 80301-2537, USA
XML strategy, XML tools (http://4Suite.org), knowledge management