tags:

views:

55

answers:

2

How do I get the URL of the XML page from within the XSL, if it is not defined in the XML?

+1  A: 

XSLT doesn't have a mechanism in and of itself to fetch the URL which it was retrieved from. However You could try using Javascript to pass the URL as a parameter to the stylesheet. Much like what this guy does.

Jweede
Thanks for the response JWeede, but I'm a complete noob when it comes to XSLT and I have no idea where the `ParameterBinding` variables should be located. I get an error if I add them to my XSL, does it go somewhere else?
fudgey
basically his suggestion is to grab the URL information with javascript and then pass it into XSLT as a parameter. If you have access to manipulate the incoming XML to XSLT this is an option as well.
Jweede
+1  A: 

Within an XSLT 2.0 stylesheet you may be able to use the standard XPath 2.x functions base-uri() and document-uri()

Dimitre Novatchev
Sadly, only XSLT 1.0 is available to me
fudgey