[xsl] document() to get root node of xml file???

Subject: [xsl] document() to get root node of xml file???
From: hnorris <hnorrisalt@xxxxxxxxx>
Date: Wed, 13 Feb 2002 01:53:35 -0500
Hi Bryan -

Thanks for your reply! Do you ( or anybody else) happen to know how to use
the document() function to get to the root node of the xml file that you're
applying your stylesheet to? Or are there better, alternative ways of getting your
xml file root node??


Michael Kay suggests in his Xslt 2nd edition book that you can do this
by using an empty string argument to document(), but I can't get it to
work - he suggests you have to coordinate the base URI with the
system id of the stylesheet module, whatever the hell that means(!)
Examples anyone? Seems extremely complicated. Even more confusing,
he says that document('') is used to get the root node of the stylesheet - what
would you do with that? Didn't he mean the root node of the xml file you're
applying the stylesheet to? His book shows an example which suggests
this was his actual meaning. Very confusing!!


Any light you can shed on this obscure topic of how to the get your
root node (for your xml data file), regardless of the current node context,
would be greatly appreciated!

- Holten



Bryan Rasmussen wrote:


Is it possible to use the xslt document() function to
get the root node of a non-file - in this case a tree
passed in a as param?


select="document($paramDocumentName)/Properties/Value"


if you have a single command to the document function it's a uri, so no it's not possible, what you should do is use a nodeset function, if your processor has an extension for that, for example saxon has saxon:nodeset($paramDocumentName)/Properties/Value, if you're using a processor that supports xslt 1.1 you don't have to use an extension to get nodeset.


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






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


Current Thread