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 August 5th, 2009, 07:57 PM
Registered User
 
Join Date: Aug 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Copy full XML to output as string

In my XSLT, I need to copy the full SOAP/XML message into a string in the output XML.
How do I do that?
 
Old August 6th, 2009, 12:10 AM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 291
Thanks: 9
Thanked 29 Times in 29 Posts
Thumbs up

<xsl:copy-of> can be used to copy the nodes. If this answer is not sufficient, just post the input xml, your xslt and the needed output xml. We shall provide you the solution.
__________________
Rummy
 
Old August 7th, 2009, 11:39 AM
Registered User
 
Join Date: Aug 2009
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default urgent: tag is missing from output

I do the:

<xsl:copy-of select="ancestor-or-self::node()"/>

and it pulls in the input XML file exactly like I want EXCEPT that the envelope tag is missing...
If you look at my input XML and the output, you will notice that the "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org..." line is missing from the output. Why is this? How do I rectify this?

Here is the input XML:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Header soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    <soapenv:Body soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        <bea:RouterService 		xmlns:bea="http://www.bea.com/servers/wls70/samples/examples/webservices/basic/statelessSession">
            <string xsi:type="xsd:string">ABCDEFG</string>
        </bea:RouterService>
    </soapenv:Body>
</soapenv:Envelope>
and here is my xslt
Code:
 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml"/>
    <xsl:template match="/">
        <xsl:copy-of select="ancestor-or-self::node()"/>
    </xsl:template>
</xsl:stylesheet>
and here is my output
Code:
 
<?xml version="1.0" encoding="utf-8"?><string><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Header soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    <soapenv:Body soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        <bea:RouterService xmlns:bea="http://www.bea.com/servers/wls70/samples/examples/webservices/basic/statelessSession">
            <string xsi:type="xsd:string">XDO267A61897</string>
        </bea:RouterService>
    </soapenv:Body>
</soapenv:Envelope></string>





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to output the entire content to a string sunnyman XML 6 November 29th, 2007 10:48 PM
Copy source-element to output tree der_bAUer XSLT 2 June 9th, 2006 08:17 AM
copy xml to xml (with java script) Umen XML 4 September 14th, 2004 06:51 AM
copy-of with disable-output-escaping? andrin XSLT 5 July 16th, 2004 04:46 AM
how to output non-well formed string harag XSLT 5 November 10th, 2003 11:47 PM





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