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
2010-06-11 15:50:30
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
2010-06-11 17:21:59
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
2010-06-11 17:48:44
+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
2010-06-11 16:11:54