How can I retrieve the XML source file name using XSL 1.0 code?
In XSLT 2.0, there are two relevant functions: base-uri() and document-uri().
In XSLT 1.0, you have to pass the URL or filename as a parameter to the stylesheet, unless the processor offers extension functions for the purpose.
With Xalan there is the following, non-official function :
<xsl:value-of select="document-location()"/>
I use it on a transformation of a local file and it gives me the absolute path of the XML file being transformed. I found that function browsing the Xalan code, it is part of the class FuncDoclocation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With