Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 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 March 19th, 2008, 03:12 PM
Authorized User
 
Join Date: Jun 2003
Location: Corona, CA, USA.
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
Reply With Quote
  #2 (permalink)  
Old March 20th, 2008, 05:59 AM
Friend of Wrox
Points: 1,676, Level: 16
Points: 1,676, Level: 16 Points: 1,676, Level: 16 Points: 1,676, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2006
Location: , , .
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>
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
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



All times are GMT -4. The time now is 01:49 PM.


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