|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Getting at original document from inside document(
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








