Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 13th, 2006, 03:48 AM
Registered User
 
Join Date: Jan 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Extrac URL from in the XSL file

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
 
Old January 13th, 2006, 05:03 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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
 
Old January 13th, 2006, 05:14 AM
Registered User
 
Join Date: Jan 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

 
Old January 13th, 2006, 05:36 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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
 
Old January 13th, 2006, 05:54 AM
Registered User
 
Join Date: Jan 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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…???






Similar Threads
Thread Thread Starter Forum Replies Last Post
Redirect URL to File path han_nomad C# 12 February 2nd, 2007 06:26 AM
file path does not correspond to url rnelson330 .NET Framework 1.x 1 May 27th, 2006 09:42 AM
URL variables in XSL Pinguin89 XSLT 1 March 16th, 2006 10:57 AM
Posting an XML file to an URL from C virajithasarma XML 0 October 7th, 2005 01:47 AM
XSL Transform with xsl string NOT xsl file skin XSLT 0 June 16th, 2003 07:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.