xsl-list
[Top] [All Lists]

Re: Input Filenames available to the parser?

2006-01-04 15:30:41
On 1/4/06, Agnisys <agnisys(_at_)yahoo(_dot_)com> 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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--