|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi everyone!
Please help me with this problem. I am using the follwing javascript code to do an XSL-XML transformation. It's working fine on my computer when I double-click the html page but once the files are uploaded the transformation doesn't work there. Even more if I test the pages through the IIS as a virtual directory (but still in my computer) it doesn't work neither. I am figuring out the problem is because the "xml/hotel_list.xml" and "xml/hotel_list.xsl" relative paths are not working in the xslDoc.load statements but I have tested several alternatives using "http://..." paths and I can't make this work. I would appreciate any help you can give me I am feeling lost and frustated. This is the javascript function: function filter_destino(filtro_destino,column){ try{ var xslDoc = new ActiveXObject("MSXML2.FreeThreadedDOMDocument"); xslDoc.load("xml/hotel_list.xsl"); var xslt = new ActiveXObject("MSXML2.XSLTemplate"); xslt.stylesheet = xslDoc; var xslProc = xslt.createProcessor(); xslProc.addParameter("column", column); xslProc.addParameter("filtro_destino", filtro_destino); var xmlDoc = new ActiveXObject("Msxml2.DOMDocument"); xmlDoc.async = false; xmlDoc.resolveExternals = false; xmlDoc.load("xml/hotel_list.xml"); xslProc.input = xmlDoc; xslProc.transform(); document.all.item("xslContainer").innerHTML=xslProc.output; }catch(exception){ } } The function is called from an html on the Body onLoad event: <BODY onLoad="filter_destino('Cancun','HOTEL_NAME');"> The javascript function is in a external file referenced at the head section in this html page. <script language="javascript" src="javascripts/filter.js"></script> The first lines of the xsl files are: <?xml version='1.0' encoding='iso-8859-1' ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"> <xsl:output method="html" indent="yes" encoding="iso-8859-1" media-type="text/html"/> <xsl:param name="column" select="'HOTEL_NAME'" /> <xsl:param name="name" select="''" /> <xsl:param name="filtro_destino" select="''" /> <xsl:variable name="destino" select="HOTEL[HOTEL_DESTINATION=$filtro_destino]" /> Thanks in advance. Ricardo |
|
#2
|
|||
|
|||
|
Try loading your doc relative to the website root. For example if your file is located at : http://www.yoursite.com/xml/hotel_list.xml, then load your file as :
xml.load(server.mappath("/xml/hotel_list.xml") // Sorry i don't know the JS equivalent for 'server.mappath |
|
#3
|
|||
|
|||
|
Thanks imbrokn
Thanks for your reply, I find out the problem this morning, it was the async property of the xsl file. I was setting to false this property before the load of the xml file but I wasn't doing it for the xsl file.
It was a good situatuion to learn a little more about xml. Thank you very much for your reply. Ricardo. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > XSL Transformation works fine locally but not when the files are uploaded |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|