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

AW: Getting at original document from inside document(

Subject: AW: Getting at original document from inside document()
From: Ursprung Manfred <Manfred.Ursprung@xxxxxxxxxx>
Date: Tue, 23 Oct 2001 15:43:29 +0200
AW:  Getting at original document from inside document(
One way would be to store root of original document in a variable.
Like:
<xsl:variable name="original" select="/" />

This should work.

- Manfred

> -----Ursprüngliche Nachricht-----
> Von:	Phil Endecott [SMTP:spam-from-xsl-list@xxxxxxxxxxxx]
> Gesendet am:	Dienstag, 23. Oktober 2001 15:25
> An:	XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Betreff:	 Getting at original document from inside document()
> 
> Dear XSL experts,
> 
> Once I am in a document selected by a document() function, is there
> any way to refer to nodes in the original source document?
> 
> Here's a (contrived) example: I have this as my main source document:
> 
> <book title="foo">
>   <chapter src="chap1.xml"/>
> </book>
> 
> Then I have a stylesheet that does something like:
> 
> <xsl:template match="chapter">
>   <xsl:apply-templates select="document(@src)/*"/>
> </xsl:template>
> 
> and then somewhere deep in the processing of the chapter's contents I
> want to use the book's title.  At first I naively tried /book/@title -
> but that doesn't work, because / is the root of chap1.xml, not of the
> source document.  I could use document('....')/book/@title, if I knew
> what the name of the original source file was: but I don't.
> 
> 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.
> 
> Of course there are various hacks to get or fix the filename that
> could have the desired effect, but I was hoping that someone would
> know of a "clean" way to do this.
> 
> Any ideas anyone?
> 
> Maybe there is a case for adding something to the next XSL to do this?
> 
> Thanks,
> 
> --Phil.
> 
> 
>  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

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.