RE: The document() function....again !!

Subject: RE: The document() function....again !!
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Mon, 16 Oct 2000 11:12:56 +0100
> While I am an eager to get help from anyone, I want to direct 
> this question
> to "our teachers" in the group (Alan Kay, Jeni Tennison, and others).

Alan Kay is the Smalltalk man. Wrong language...

> Could someone please explain what goes on in the the XSLT call to
> document().
> 
>              <xsl:apply-templates
> select="document(somefile.xml)/some_element[@aval='true']"

try document('somfile.xml')

> 2.)   In [Mike] Kay's Wrox text on XSLT he goes to great length 
> to draw the
> schematics of the XML input tree, XSLT transform and output trees.
>        How is that structure impacted by a call to document() 
> ? Is a second
> Input tree created ?  If so what mechanism is used to
>       alternate between those data structures.

Yes, a second input tree is created. To get back to the original tree, it's
a good idea to have a global variable

<xsl:variable name="root" select="/"/>

so you can get back any time using $root. To get back to the secondary
document, just call document() again with the same URI, or set up another
global variable.

Note that many XPath expressions such as "//item" or "key('k', $val)"
implicitly access the "current document", i.e. the one containing the
context node.

Mike Kay 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread