|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
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








