|
Subject:
|
Extrac URL from in the XSL file
|
|
Posted By:
|
MM_lost
|
Post Date:
|
1/13/2006 2:48:54 AM
|
Hi,
i am new to XSLT. i guess my problem is simple but i just cant make it work. i would like to extract in the XSL file the URL of the processed XML file.
so for exmple, i have the XML file "test.xml", which starts as with the tag:
<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="http://ww.blabla.ch/this.xsl"?>
so in the XSL file "this.xsl" i would like to write out in HTML the URL of the XML file "test.xml". for example to make a simple HTML page as:
<html> <body>
<p> The processed xml file has the link: 'link_of_the_xml_file'</p> </body> </html>
thanks much for help! Lukas
|
|
Reply By:
|
mhkay
|
Reply Date:
|
1/13/2006 4:03:58 AM
|
You need to pass the filename or URI as a parameter to the transformation.
Michael Kay http://www.saxonica.com/ Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
|
Reply By:
|
MM_lost
|
Reply Date:
|
1/13/2006 4:14:00 AM
|
Hi Michael,
first thanks for your answer. however, i am still a bit lost. would you mind to detail how i could pass the filename to the xsl? do i have to write the filename in the xml file so it can be extracted by the xsl? or is there a smarter way.
thanks much, lukas
|
|
Reply By:
|
mhkay
|
Reply Date:
|
1/13/2006 4:36:32 AM
|
Sorry, I didn't spot that you were invoking the transformation using the <?xml-stylesheet?> PI. This doesn't allow you to pass parameters to the stylesheet, unfortunately. Assuming you are running the transformation within the browser, you would need to switch to using a JavaScript API to run the transformation, for example the Microsoft API or the cross-browser Sarissa API.
Michael Kay http://www.saxonica.com/ Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
|
Reply By:
|
MM_lost
|
Reply Date:
|
1/13/2006 4:54:08 AM
|
hm… but wouldnt it be possible to just extract the URL of the transfromed XML file in the XSL file? like here with the fictional function "get_XML_URL()" :
<xsl:variable name="CURRENT_URL"> <xsl:value-of select="get_XML_URL()"/> </xsl:variable>
cant believe that this is not possible…???
|