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

Re: Creating multiple xmls using xslt1.0

Subject: Re: Creating multiple xmls using xslt1.0
From: Liam R E Quin <liam@xxxxxx>
Date: Thu, 17 May 2012 16:09:40 -0400
Re:  Creating multiple xmls using xslt1.0
On Thu, 2012-05-17 at 11:21 +0000, Siddhi Thakkar wrote:
> Hi experts, 
> 
> I have an xml file like this:
[...]
> And I have thousands of <Row> elements like this. For the first 50
> rows, I should be able to create an output xml with name Data1.xml,
> for next 50 rows output xml should be data2.xml,

So there are three parts to this.
(1) selecting the right elements, e.g. with Muenchian grouping;
(2) generating the file names, probably using position()
(3) writing to multiple files, which will require the use of the
    exslt extensions, or the xt extensions, or XSLT 2,
    or some other non-XSLT-1.0 approach.

With the xt extensions, supported by xt and by libxml,
xmlns:xt="http://www.jclark.com/xt"

<xsl:template name="write-one-file">
  <xsl:param name="what-to-write" />
  <xsl:param="filename" />
  <xt:document method="html" href="{$filename}">
    <xsl:apply-templates select="$what-to-write" />
  </xs:document>
</xsl:template>

But not all processors support that. So best if you mention which XSLT
processor you're using. Always best to give people enough information to
help you :-) These days I mostly use Saxon and xsl:result-document.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml

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.