hi,
i've been trying to work with xml/xsl for about a day now, and i'm already stuck. The problem is i know too little to be able to say where it goes wrong.
This is what i'm trying to do: i send a request to a server, and they send xml back to me. From this xml i need to fish things out for later to use in the database. But at this point, i can't get far enough to get anything out of the xml i get back.
I work with ColdFusion, and i use the XMlDom object. This is what the code looks like:
<!--- read the xml document --->
<cffile action="READ" file="d:\source\testptt\pt
t\SayHello
.xml" variable="xmlFile">
<cfscript>
//send request
xmlhttp = CreateObject ("COM","Microsoft.XMLHTTP"
);
xmlhttp.Open ("POST", "
https://www.multimall.nl/servlet/ecsxmlagent"
, false);
xmlhttp.Send (xmlFile);
</cfscript>
<!--- load the xsl document --->
<cffile action="READ" file="d:\source\testptt\pt
t\SayHello
.xsl" variable="xslFile">
<cfscript>
xmlDoc = CreateObject ("COM", "Microsoft.XMLDom");
xslDoc = CreateObject ("COM", "Microsoft.XMLDom");
xmlDoc.async = false;
xslDoc.async = false;
xmlDoc.validateOnParse = false;
xslDoc.validateOnParse = false;
xmlDoc.load (xmlFile);
xslDoc.loadXML (xslFile);
result = xmlDoc.transformNode (xslDoc);
</cfscript>
The xml i get back looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<SayHelloA xmlns:xsi="
http://www.w3.org/1999/XMLSchema-instance"
xsi:noNamespaceSchemaLocat
ion="
http://cashdesk.e-commerceservices.nl/schema/v1.0/SayHello.xsd">
<SayHello>
<OUTPUT>zsanett! The XML interface works!</OUTPUT>
</SayHello>
</SayHelloA>
If i just display xmlhttp.responseText, i do see this xml correctly.
My xsl:
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="
http://www.w3.org/TR/WD-xsl" >
<xsl:template match="/" >
<TABLE STYLE="border:1px solid black" >
<TR STYLE="font-size:12pt; font-family:Verdana; font-weight:bold; text-decoration:underline"
>
<TD STYLE="background-color:li
ghtgrey" >This</TD>
</TR>
<TR STYLE="font-family:Verdana
; font-size:12pt; padding:0px 6px" >
<TD>
<xsl:value-of select="OUTPUT" />
</TD>
</TR>
</TABLE>
</xsl:template>
</xsl:stylesheet>
I've tried it with two local files, (i've copied the xml i get back from the server), but with the same result. The actual data get lost somewhere on the way.
Do you have any idea where? I should think in my xsl, but why?
thanks,
kandura
Start Free Trial