Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 20th, 2006, 08:21 AM
Registered User
 
Join Date: Dec 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default How do you transform a XML SOAP Response using XSL

I am trying to transform a XML document using a XSL stylesheet. In XMLSpy the XSL Stylesheet transforms the XML correctly, but when I try to do it on the fly using the SOAP response it doesn't work. I am not familar with VBScript. I having been trying to do the transformation using Coldfusion MX7's Xmltranform() function. I get a "file cannot be displayed error".

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

Thank you in advance

Wil

Below is the Soap Message and the XSL Stylesheet that I am using.

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>


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XSL for transforming SOAP response doonghati XSLT 1 January 5th, 2008 05:57 AM
Browser transform using local XSL and remote XML sosarder XSLT 1 March 13th, 2007 02:58 PM
Trouble Transforming an XML SOAP Response with XSL wsessoms XSLT 1 December 20th, 2006 01:47 PM
SOAP and XSL(T) NEO1976 XSLT 7 August 22nd, 2006 09:45 AM
XSL Transform with xsl string NOT xsl file skin XSLT 0 June 16th, 2003 07:30 AM



All times are GMT -4. The time now is 02:36 PM.


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