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 December 20th, 2006, 07:31 AM
Registered User
 
Join Date: Dec 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Trouble Transforming an XML SOAP Response with XSL

I am trying to transform a XML document using Coldfusion MX7's XmlTransform() function and it is not working with the XSL stylesheet that I am trying to attach. In XMLSpy the XSL Stylesheet transforms the XML correctly, but with I try to doit on the fly using the SOAP response it dosn't work. I get a file cannot be displayed error.

Can someone help me by writing the code that will do this in vbscript?

thank you inadvance

Wil
: below is the Soap Message and the XSL stylesheet.

SOAP Message
 <?xml version="1.0" encoding="UTF-8" ?>
- <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
- <SOAP-ENV:Body>
- <barceloDS_responses ip="69.121.64.141">
- <response>
- <request id="1" type="valued availability list">
  <session_id>aaa6SP8c6P5BAJ</session_id>
  <language_code>ING</language_code>
- <agency>
  <primary>888</primary>
  <secondary>88</secondary>
  <detail>888</detail>
  <branch>1</branch>
  </agency>
  <contract />
  <check_in_date>20061221</check_in_date>
  <check_out_date>20061228</check_out_date>
- <location>
  <destination_code>NYC</destination_code>
  <zone_code />
  </location>
- <establishment>
  <code />
  <category />
  </establishment>
  <board_type />
- <occupancy>
  <adults>2</adults>
  <children>0</children>
  <rooms>1</rooms>
  </occupancy>
  </request>
- <valued_list>
  <valuation_file_number>9042</valuation_file_number>
  <total_pages>1</total_pages>
  <current_page>1</current_page>
  <total_hotels>7</total_hotels>
- <establishment>
  <code>6467</code>
  <description>Sheraton Manhattan</description>
  <contract>3.3RDXML</contract>
  <child_min_age>0</child_min_age>
  <child_max_age>12</child_max_age>
- <location>
- <destination>
  <code>NYC</code>
  <description>New York City - NY</description>
  </destination>
- <zone>
  <code>15</code>
  <description>Midtown West</description>
  </zone>
  </location>
- <category>
  <code>4EST</code>
  <description>4 STARS</description>
  </category>
  <incoming_contract>X60071769</incoming_contract>
  <offer>YES</offer>
  <classification>NOR</classification>
  <currency>EUR</currency>
- <room>
  <code>DBL.SU</code>
  <description>DOUBLE/ TWIN SUPERIOR</description>
  <availability>996</availability>
- <price>
- <occupancy>
  <adults>2</adults>
  <children>0</children>
  <rooms>1</rooms>
  </occupancy>
- <board_type>
  <code>HD</code>
  <description>BED AND BREAKFAST</description>
  </board_type>
  <amount>269.43</amount>
  </price>
  </room>
  </establishment>
- <establishment>
  <code>12998</code>
  <description>Bentley</description>
  <contract>3.3RDXML</contract>
  <child_min_age>0</child_min_age>
  <child_max_age>12</child_max_age>
- <location>
- <destination>
  <code>NYC</code>
  <description>New York City - NY</description>
  </destination>
- <zone>
  <code>17</code>
  <description>Upper East Side</description>
  </zone>
  </location>
- <category>
  <code>4EST</code>
  <description>4 STARS</description>
  </category>
  <incoming_contract>X60071769</incoming_contract>
  <offer>YES</offer>
  <classification>NOR</classification>
  <currency>EUR</currency>
- <room>
  <code>DBL.SU</code>
  <description>DOUBLE/ TWIN SUPERIOR</description>
  <availability>995</availability>
- <price>
- <occupancy>
  <adults>2</adults>
  <children>0</children>
  <rooms>1</rooms>
  </occupancy>
- <board_type>
  <code>HD</code>
  <description>BED AND BREAKFAST</description>
  </board_type>
  <amount>386.54</amount>
  </price>
  </room>
- <room>
  <code>DBL.ST</code>
  <description>DOUBLE/ TWIN STANDARD</description>
  <availability>997</availability>
- <price>
- <occupancy>
  <adults>2</adults>
  <children>0</children>
  <rooms>1</rooms>
  </occupancy>
- <board_type>
  <code>HD</code>
  <description>BED AND BREAKFAST</description>
  </board_type>
  <amount>544.74</amount>
  </price>
  </room>
  </establishment>
  </valued_list>
  </response>
  </barceloDS_responses>
  </SOAP-ENV:Body>
  </SOAP-ENV:Envelope>

Below is the XSL Stylesheet
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
        <xsl:template match="node()|text()">
        <xsl:copy>
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="node()|text()"/>
        </xsl:copy>
    </xsl:template>
    <xsl:template match="establishment[count(room) &gt; 1]">
        <xsl:for-each select="room">
            <establishment>
                <xsl:copy-of select="./@*"/>
                <xsl:apply-templates select="preceding-sibling::*[not(name() = 'room')] | preceding-sibling::text()"/>
                <xsl:copy-of select="."/>
                <xsl:apply-templates select="following-sibling::*[not(name() = 'room')] | following-sibling::text()"/>
            </establishment>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>

 
Old December 20th, 2006, 01:47 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

>I get a file cannot be displayed error.

That suggests to me that the problem is nothing to do with the XML and XSLT code that you have posted, and is instead something to do with the way you are running the transformation. All you've told us about that is that you are using ColdFusion MX7's XmlTransform() method. It looks as if you are using it incorrectly. So to help you, one will need (a) to see your code, and (b) to know Coldfusion's API. You're likely to be better off on a list that's specific to that product.

Incidentally, it also helps to post the precise error message, not a paraphrase. The exact wording might mean nothing to you, but it might well be recognized by someone else.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
XSL for transforming SOAP response doonghati XSLT 1 January 5th, 2008 05:57 AM
Help needed transforming plist to XML by XSL Vartan XSLT 4 September 28th, 2007 03:11 PM
Transforming XML to XML using XSL sakreck XSLT 0 January 9th, 2007 11:48 AM
How do you transform a XML SOAP Response using XSL wsessoms VB How-To 0 December 20th, 2006 08:21 AM
XSL transforming to TEXT suri_1811 XSLT 8 October 30th, 2006 05:02 AM





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