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

Re: how to split one xml to multiple xml files

Subject: Re: how to split one xml to multiple xml files
From: Qin Ding <qding@xxxxxxx>
Date: Fri, 30 Apr 2004 16:17:23 -0400
split xml files
I tried to split a big xml file into multiple xml files based on the
<pg-nbr>.  If I have this:
<chapter>
   <section id="sc1">
       <subsection id="sb1">
          <pg-nbr id="p1"></pg-nbr>
          <pg-nbr id="p2"></pg-nbr>
          <pg-nbr id="p3"></pg-nbr>
          <pg-nbr id="p4"></pg-nbr>
       </subsection>
       <subsection id="sb2">
          <pg-nbr id="p5"></pg-nbr>
          <pg-nbr id="p6"></pg-nbr>
          <pg-nbr id="p7"></pg-nbr>
       </subsection>
   </section>
   <section id="sc2">
       <subsection id="sb3">
          <pg-nbr id="p8"></pg-nbr>
       </subsection>
       <subsection id="sb4">
          <pg-nbr id="p9"></pg-nbr>
          <pg-nbr id="p10"></pg-nbr>
       </subsection>
   </section>
</chapter>

I want to split above files to this file:
sc1sb1p1.xml
<chapter>
   <section id="sc1">
      <subsection id="sb1">
         <pg-nbr id="p1><pg-nbr>
      </subsection>
   </section>
</chapter>

sc1sb1p2.xml
<chapter>
   <section id="sc1">
      <subsection id="sb1">
         <pg-nbr id="p2><pg-nbr>
      </subsection>
   </section>
</chapter>

sc1sb1p3.xml
<chapter>
   <section id="sc1">
      <subsection id="sb1">
         <pg-nbr id="p3><pg-nbr>
      </subsection>
   </section>
</chapter>

etc and etc.

How do I write xsl logic?  How do I automatically generate the output file
name?  How do I go through the loop to create many, many smaller xml files?
In above example, I should have 10 xml files created.   Someone suggests
that I use xsl:document href="" to output the xml files.  I tried to use
that but I can't even compile my xsl file.  Can someone show me how to do
this, please?  Thank you very much.

Qin
----------------------------------------------------------------------------------------

This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit written
agreement or government initiative expressly permitting the use of e-mail
for such purpose.
----------------------------------------------------------------------------------------

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.