xsl-list
[Top] [All Lists]

[xsl] Breaking up a large XML document into several smaller ones

2008-01-11 07:49:17
Hello,

I searched the XSLT FAQ and could not find an answer to this.  If only
for proof-of-concept (we may find better solutions not needing this),
I am interested in breaking up a very large XML document into multiple
smaller ones, and was wondering if XSLT would be a good solution for
this.  For example, if I have the following:

<order>
   <widgets>
       <widget.../>
       <widget.../>
       ... (about 100000 widgets) ...
   </widgets>
</order>

And, as output, I would like about hundred documents of 1000 widgets
each, with the last document having the remainder (possibly not 1000)
widgets:

<order>
   <widgets>
       <widget../>     // widget #1

       <widget.../>    // widget #1000
   </widgets>
</order>

<order>
   <widgets>
       <widget../>     // widget #1001

       <widget.../>    // widget #2000
   </widgets>
</order>
...

Can this be done via XSLT, or would a SAX-based solution be more
appropriate, or?

Thanks,
Glen

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--