Subject: Re: [xsl] Getting at original document from inside document() From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Tue, 23 Oct 2001 14:56:35 +0100 |
Hi Phil, > I was hoping that something like document('')/book/@title would get > the answer, but it looks like this gets the stylesheet, not the > original input document. Whenever I have a stylesheet that deals with multiple documents, I have a global variable to hold the root node of the source XML document: <xsl:variable name="source" select="/" /> This guarantees that I can get back to the information from the original source document no matter where I am. So you can use: $source/book/@title to get the title of the book. > Maybe there is a case for adding something to the next XSL to do > this? While I think this particular problems can be addressed as above, I agree that it's often helpful to be able to get hold of the URI for the source document, and even the stylesheet, for example to add comments like: <!-- transformed from source.xml by my favourite XSLT processor --> Perhaps a base-uri() function or extending the system-property() function: system-property('xsl:source-uri') system-property('xsl:stylesheet-uri') Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Getting at original docum, Oleg Tkachenko | Thread | Re: [xsl] Getting at original docum, Oleg Tkachenko |
Re: [xsl] Getting at original docum, Oleg Tkachenko | Date | Re: [xsl] better way to get a sibli, Oleg Tkachenko |
Month |