[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Embeding xml inside another xml using xslt

Subject: Re: Embeding xml inside another xml using xslt
From: James Fuller <jim.fuller@xxxxxxxxxxxxxx>
Date: Mon, 28 Feb 2005 16:22:33 +0100
include xml inside xml
babu.eshwaramoorthy@xxxxxxxxx wrote:

Hi All,

Can any one help me to implement the below.

I want to form an XML which will have another XML embedded in it using
XSLT

For example I want the output to be as below

<!--- XML1 -->
<?xml version="1.0" encoding="UTF-8"?>
<note xmlns="http://www.w3schools.com" >
	<to>Request</to>
	<from>String</from>
	<address>
<!--- 	Embeded XML2 -->
	<?xml version="1.0" encoding="UTF-8"?>
	<Address xmlns="http://www.w3schools.com" >
		<Street>St Joseph Street</Address>
		<State>CA</State>
		<Country>US</Country>
	</Address>

</address>
<body>String</body>
</note>



hmmmm, a few things;


- u might find something here (http://www.dpawson.co.uk/xsl/sect2/N4760.html)

- btw no need for another XML PI e.g. <!xml in the body (above embed xml2), most processors will choke on such things

- you could use an xinclude style approach to including xml documents in other xml documents, though of course you then need your processor to be xinclude aware

then your xml would look like;

<?xml version="1.0" encoding="UTF-8"?>
<note xmlns="http://www.w3schools.com" >
	<to>Request</to>
	<from>String</from>
	<address>

<xi:include href="otheraddress.xml" xmlns:xinclude="http://www.w3.org/2003/XInclude"/>

	</address>
	<body>String</body>
</note>


with the embedded xml, being a seperate document....of course u need an xinclude aware processor...xerces does it..


though if u were using the embedded document principle...you could take advantage of XSL/XPATH document() command ala

<?xml version="1.0" encoding="UTF-8"?>
<note xmlns="http://www.w3schools.com" >
	<to>Request</to>
	<from>String</from>
	<address>

<address href="otheraddress.xml"/>

	</address>
	<body>String</body>
</note>


now you would have to supply document() with the attribute @href value.....a bit awkward though if you dont have access to an xinclude aware processor....



I wouldnt even bother with xlink etc...


gl, Jim Fuller

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.