[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Creating multiple xmls using xslt1.0

Subject: Re: [xsl] Creating multiple xmls using xslt1.0
From: Liam R E Quin <liam@xxxxxx>
Date: Thu, 17 May 2012 16:09:40 -0400

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,

<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" />

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 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