RE: section 14.1


The node-set of the original document is easily captured in a global

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

This variable can be called from any context in the stylesheet, giving
access to the original document, even when the context is a secondary

Agnes Clarke

-----Original Message-----
From: Zbyszynski, Marc []
Sent: Tuesday, April 02, 2002 4:52 AM
To: ''
Subject: section 14.1

	I am writing to comment on the XSLT 2.0 specification. I am very
excited that variables will be able to contain useable node-sets and I also
like some of the added key and sorting functionality. One concern that I
have that does still not seem to be addressed is the ability to reference
nodes in the principal source document while processing a node-set loaded
using the document() function. For example assuming that I have two
documents, one is a static xml file that contains a collection of reference
data (reference.xml); the other dynamic request for certain information from
reference.xml (I'll just call this the 'DataRequest'). I would like to apply
an xsl transformation to the DataRequest that collects the requested
information from reference.xml and outputs it in a new format. Assume also
that the DataRequest is streamed XML from an application, and not stored in
a file on disk. As I process my DataRequest in my xslt template, I need to
iterate through a node-set in reference.xml, so I call something like this:
	<xsl:apply-templates select="document(reference.xml)//myNodes"/>
I have defined another template that matches myNodes, and I now want to
perform a series of tests on the properties each of these to see if they
match things that are in the request. But, my <xsl:template match="myNodes">
template is matched in the context of a node-set in the reference.xml file,
and I cannot compare (as far as I can tell) any data in that node-set of the
principal source document. Following the ancestor axis from myNodes leads me
to the root node of reference.xml, but never back to my DataRequest. I
suppose, if both xml files were on disk, then I could reference the original
file again with the document() function, but that won't help my particular
real-world situation, so I never investigated it :). xsl:key nodes defined
in the xsl file also cannot be referenced across documents. I would be cool
if there were an xsl function similar to the current() function that would
provide xpath access to the principal source document even when the current
location being processed was a node set in a different source document. Have
you thought at all about this issue? As far as I could find, it is not
specifically addressed in the DataModel specification. Sorry if I missed it,
or if this type of functionality is not in the spirit of the xslt 2.0
specification. Thanks a lot for your consideration. I really appreciate the
hard work you guys do. Thanks again.

ps. it would also be great if there were some way to modify variable values
in process (such as within a for-each loop)... But I am sure I am not the
first person who has asked for that...

Marc Zbyszynski
System Architect
DoubleClick Inc.
450 West 33rd St., 12th Floor
New York, NY 10001

The contents of this e-mail are intended for the named addressee only. It
contains information that may be confidential. Unless you are the named
addressee or an authorized designee, you may not copy or use it, or disclose
it to anyone else. If you received it in error please notify us immediately
and then destroy it. 

Received on Tuesday, 2 April 2002 06:25:09 UTC