Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

msxml3.dll error for UPS Shipping Application

Status
Not open for further replies.

asmith555

Programmer
Oct 7, 2002
97
US
I keep getting the error: The stylesheet does not contain a document element. The stylesheet may be empty, or it may not be a well-formed XML document. I have included the code as follows. I am new to XML so please help me out.

XML:
<?xml version=&quot;1.0&quot;?>
<RatingServiceSelectionResponse>
<Response>
<TransactionReference>
<CustomerContext>Rating and Service</CustomerContext>
<XpciVersion>1.0001</XpciVersion>
</TransactionReference>
<ResponseStatusCode>1</ResponseStatusCode>
<ResponseStatusDescription>Success</ResponseStatusDescription>
</Response>
<RatedShipment>
<Service>
<Code>03</Code>
</Service>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>5.0</Weight>
</BillingWeight>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>3.90</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>3.90</MonetaryValue>
</TotalCharges>
<GuaranteedDaysToDelivery/>
<ScheduledDeliveryTime/>
<RatedPackage>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>3.90</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>3.90</MonetaryValue>
</TotalCharges>
<Weight>5.0</Weight>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>5.0</Weight>
</BillingWeight>
</RatedPackage>
</RatedShipment>
<RatedShipment>
<Service>
<Code>12</Code>
</Service>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>5.0</Weight>
</BillingWeight>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>5.97</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>5.97</MonetaryValue>
</TotalCharges>
<GuaranteedDaysToDelivery>3</GuaranteedDaysToDelivery>
<ScheduledDeliveryTime/>
<RatedPackage>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>5.97</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>5.97</MonetaryValue>
</TotalCharges>
<Weight>5.0</Weight>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>5.0</Weight>
</BillingWeight>
</RatedPackage>
</RatedShipment>
<RatedShipment>
<Service>
<Code>59</Code>
</Service>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>5.0</Weight>
</BillingWeight>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>10.53</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>10.53</MonetaryValue>
</TotalCharges>
<GuaranteedDaysToDelivery>2</GuaranteedDaysToDelivery>
<ScheduledDeliveryTime>12:00 Noon</ScheduledDeliveryTime>
<RatedPackage>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>10.53</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>10.53</MonetaryValue>
</TotalCharges>
<Weight>5.0</Weight>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>5.0</Weight>
</BillingWeight>
</RatedPackage>
</RatedShipment>
<RatedShipment>
<Service>
<Code>02</Code>
</Service>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>5.0</Weight>
</BillingWeight>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>9.52</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>9.52</MonetaryValue>
</TotalCharges>
<GuaranteedDaysToDelivery>2</GuaranteedDaysToDelivery>
<ScheduledDeliveryTime/>
<RatedPackage>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>9.52</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>9.52</MonetaryValue>
</TotalCharges>
<Weight>5.0</Weight>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>5.0</Weight>
</BillingWeight>
</RatedPackage>
</RatedShipment>
<RatedShipment>
<Service>
<Code>13</Code>
</Service>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>5.0</Weight>
</BillingWeight>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>16.71</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>16.71</MonetaryValue>
</TotalCharges>
<GuaranteedDaysToDelivery>1</GuaranteedDaysToDelivery>
<ScheduledDeliveryTime>3:00 P.M.</ScheduledDeliveryTime>
<RatedPackage>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>16.71</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>16.71</MonetaryValue>
</TotalCharges>
<Weight>5.0</Weight>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>5.0</Weight>
</BillingWeight>
</RatedPackage>
</RatedShipment>
<RatedShipment>
<Service>
<Code>14</Code>
</Service>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>5.0</Weight>
</BillingWeight>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>48.35</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>48.35</MonetaryValue>
</TotalCharges>
<GuaranteedDaysToDelivery>1</GuaranteedDaysToDelivery>
<ScheduledDeliveryTime>8:30 A.M.</ScheduledDeliveryTime>
<RatedPackage>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>48.35</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>48.35</MonetaryValue>
</TotalCharges>
<Weight>5.0</Weight>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>5.0</Weight>
</BillingWeight>
</RatedPackage>
</RatedShipment>
<RatedShipment>
<Service>
<Code>01</Code>
</Service>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>5.0</Weight>
</BillingWeight>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>19.49</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>19.49</MonetaryValue>
</TotalCharges>
<GuaranteedDaysToDelivery>1</GuaranteedDaysToDelivery>
<ScheduledDeliveryTime>10:30 A.M.</ScheduledDeliveryTime>
<RatedPackage>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>19.49</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>19.49</MonetaryValue>
</TotalCharges>
<Weight>5.0</Weight>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
</UnitOfMeasurement>
<Weight>5.0</Weight>
</BillingWeight>
</RatedPackage>
</RatedShipment>
</RatingServiceSelectionResponse>


Xsl:
<xsl:stylesheet version='1.0' xsl:xmlns=' <xsl:template match=&quot;RatingServiceSelectionResponse&quot;>
<xsl:for-each select=&quot;RatedShipment&quot;>
<xsl:value-of select=&quot;Service/Code&quot; />
<xsl:value-of select=&quot;TransportationCharges/MonetaryValue&quot; />
<xsl:value-of select=&quot;TransportationCharges/CurrencyCode&quot; />
<xsl:value-of select=&quot;ServiceOptionCharges/MonetaryValue&quot; />
<xsl:value-of select=&quot;ServiceOptionCharges/CurrencyCode&quot; />
<xsl:value-of select=&quot;TotalCharges/MonetaryValue&quot; />
<xsl:value-of select=&quot;TotalCharges/CurrencyCode&quot; />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

ASP:
<% Response.Buffer=True %>
<%
'dim all of our vars
Dim xml, xsl, template, processor, strXML

'you can build the query dynamically by using request.form or request.querystring, however you want to use it
strXML = &quot;<?xml version='1.0'?><AccessRequest xml:lang='en-US'>&quot; & _
&quot;<AccessLicenseNumber>xxxxxxxxxxxx</AccessLicenseNumber>&quot; & _
&quot;<UserId>asmith555</UserId>&quot; & _
&quot;<Password>semperfi76</Password>&quot; & _
&quot;</AccessRequest>&quot; & _
&quot;<?xml version='1.0'?><RatingServiceSelectionRequest xml:lang='en-US'>&quot; & _
&quot;<Request>&quot; & _
&quot;<TransactionReference>&quot; & _
&quot;<CustomerContext>Rating and Service</CustomerContext>&quot; & _
&quot;<XpciVersion>1.0001</XpciVersion>&quot; & _
&quot;</TransactionReference>&quot; & _
&quot;<RequestAction>Rate</RequestAction>&quot; & _
&quot;<RequestOption>shop</RequestOption>&quot; & _
&quot;</Request>&quot; & _
&quot;<PickupType>&quot; & _
&quot;<Code>01</Code>&quot; & _
&quot;</PickupType>&quot; & _
&quot;<Shipment>&quot; & _
&quot;<Shipper>&quot; & _
&quot;<Address>&quot; & _
&quot;<PostalCode>27284</PostalCode>&quot; & _
&quot;</Address>&quot; & _
&quot;</Shipper>&quot; & _
&quot;<ShipTo>&quot; & _
&quot;<Address>&quot; & _
&quot;<PostalCode>27408</PostalCode>&quot; & _
&quot;</Address>&quot; & _
&quot;</ShipTo>&quot; & _
&quot;<Service><Code>11</Code></Service>&quot; & _
&quot;<Package>&quot; & _
&quot;<PackagingType>&quot; & _
&quot;<Code>02</Code>&quot; & _
&quot;<Description>Package</Description>&quot; & _
&quot;</PackagingType>&quot; & _
&quot;<Description>Rate Shopping</Description>&quot; & _
&quot;<PackageWeight><Weight>5</Weight></PackageWeight>&quot; & _
&quot;</Package>&quot; & _
&quot;<ShipmentServiceOptions/>&quot; & _
&quot;</Shipment>&quot; & _
&quot;</RatingServiceSelectionRequest>&quot;

Dim xmlhttp
Set xmlhttp = Server.CreateObject(&quot;MSXML2.ServerXMLHTTP&quot;)
xmlhttp.Open &quot;POST&quot;,&quot;xmlhttp.setRequestHeader &quot;Content-Type&quot;, &quot;application/x-xmlhttp.send strXML
Response.Write(xmlhttp.responseText)

Set xml = Server.CreateObject(&quot;MSXML2.FreeThreadedDOMDocument.3.0&quot;)
xml.async = false
xml.loadXml(xmlhttp.responseText)

Set xsl = Server.CreateObject(&quot;MSXML2.FreeThreadedDOMDocument.3.0&quot;)
xsl.async = false
Set template = Server.CreateObject(&quot;MSXML2.XSLTemplate&quot;)
xsl.Load(Server.MapPath(&quot;ups-shipping-rates.xsl&quot;))

template.stylesheet = xsl
set processor = template.createProcessor()
processor.input = xml

processor.transform()

'Here is the final transformation to the browser, everything is sent downstream
Response.write (processor.output)

Set xsl = Nothing
Set xml = Nothing
Set xmlhttp = Nothing
Set template = Nothing
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top