[EMAIL PROTECTED] wrote:
> 
> Stephen Cranefield ([EMAIL PROTECTED]) writes:
> >Does Xalan-Java apply keys to additional source documents loaded using
> >the document() function?
> 
> and later, he wrote:
> >I missed all of this [12.2 context-node stuff], but now that I have
> >added the for-each to my code it works.
> 
> Could you please show us how you added that for-each? I tried to make a
> verson of Uche's example and couldn't get it to work without a for-each
> encompassing the call to key(), which I think is required by the spec.

Yes.  I hadn't realized the code on dW has not been updated to reflect
this.  I'll have that done.  I discovered (and fixed) this bug in 4XSLT
last year while writing the following article which uses the same
technique:

http://www-106.ibm.com/developerworks/library/x-xsltip.html

And comparing the 4XSLT results against Saxon.


> Recapitulating the issue:
> >I was trying to follow Uche Ogbuji's example code and
> >thought that just writing this as a top-level element would work to
> >set up the keys:
> >  <xsl:variable name="load_java_reserved_words"
> >    select="document('java_reserved_words.xml')"/>
> Apparently, Uche suggested this as a way to apply document() to a
> file that has a data table that should populate a keyspace. In the
> original example on DeveloperWorks, it was document('') to cause
> reading of the stylesheet itself. But when key() is invoked, "it
> returns a node-set containing nodes in the same document as the context
> node..." to quote the spec. So you can't just create a keyspace in
> memory and use key() blindly; the keyspace is associated with a source
> document that must be the source of the context node, even if you have
> to use for-each to change your point of view.

True.  And this is where the article in question needs to be fixed.

Thanks all for pointing this out.


-- 
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

Reply via email to