[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Getting at original document from inside document(

Subject: Re: Getting at original document from inside document()
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 23 Oct 2001 14:56:35 +0100
xslt original document name
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.