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 March 19th, 2008, 03:12 PM
Authorized User
 
Join Date: Jun 2003
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to victorcorey
Default Convert 1 big XML to multiple smaller XML

I have 1 big XML file that I need to process and create multiple smaller XML files. I need to create multiple XML files based on the lob attribute and the region node. (example XML snippet below). The dealrow can have 3 different lob values and 5 different region nodes. So I would need to create a separate XML file for the "hotelbased" lob in the "Southwest" region. Then possibly a "cruise" lob in the "North" region.

BIG XML FILE
Code:
<?xml version="1.0" encoding="utf-8"?>
<campaign>
    <dealrow lob="hotelbased">
       <region>Southwest</region>
       <subregion>Arizona</subregion>
       <destination>Page</destination>
       <hotelname><![CDATA[Quality Inn at Lake Powell]]></hotelname>
       <starrating>3</starrating>
       <traveleropinion>3.5</traveleropinion>
       <traveleropinioncount>40</traveleropinioncount>
       <price rank="1">89</price>
       <price rank="2">239</price>
    </dealrow>
</campaign>
--
Victor Corey
__________________
--
Victor Corey
 
Old March 20th, 2008, 05:59 AM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

This is possible. If you are using XSLT 2.0 then use <xsl:resulting-document>

Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:xs="http://www.w3.org/2001/XMLSchema"
 xmlns:fn="http://www.w3.org/2005/xpath-functions">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:result-document href="myxml.xml">

    </xsl:result-document>
    <xsl:result-document href="my2ndxml.xml">

    </xsl:result-document>
</xsl:stylesheet>





Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple input xml / get data from other xml file elayaraja.s XSLT 3 July 25th, 2008 06:59 AM
Convert XML to XML template question bonekrusher XSLT 3 July 12th, 2007 07:47 AM
convert XML to XMl - Another Namespace question bonekrusher XSLT 2 July 10th, 2007 07:32 AM
Parsing a BIG XML and store it in DB pravind XML 0 March 14th, 2006 06:35 AM
Parsing a BIG XML and store it in DB pravind XSLT 0 March 14th, 2006 05:50 AM





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