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

Re: Input Filenames available to the parser?

Subject: Re: Input Filenames available to the parser?
From: andrew welch <andrew.j.welch@xxxxxxxxx>
Date: Wed, 4 Jan 2006 22:30:41 +0000
Re:  Input Filenames available to the parser?
On 1/4/06, Agnisys <agnisys@xxxxxxxxx> wrote:
> Hi,
>   (Using Saxon8B, XSLT 2.0)
>   Is the name of the input XML file and the XSLT file available to the
parser? If not, how can the
> following be done?
>
> For example:
> If input is "in.xml" being processed by "xform.xsl", I want the generated
output to list the two
> files as ...
>
> :
> //Input XML   : in.xml
> //Transformer : xform.xsl

You can use the base-uri() function to return the uri of the tree
containing the context node, so to get the input filename use:

//Input XML :<xsl:value-of select="tokenize(base-uri(/), '/')[last()]"/>

To get the stylesheet filename you could use base-uri(document(''))
but do you really need to discover it... couldn't you just hard code
it in as you decide the name when you do file -> save :)

By the way, there was a change between Saxon 8.6 and 8.6.1 where
document-uri() became base-uri() (I think anyway, I had to make the
change, maybe Mike will confirm) so it's worth getting the very latest
version.

cheers
andrew

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.