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

RE: Splitting multiple node occurrences into separate

Subject: RE: Splitting multiple node occurrences into separate xmls
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 29 Apr 2005 09:20:24 +0100
splitting the xmls
> > > I need to do a transformation that will take an input xml
> > > string in a format
> > > that is something like
> > > ...<a>1</a><a>2</a><a>3</a><a>4</a>...
> > > and apart from transforming it, will split the multiple node
> > > occurrences for
> > > "a" into different xml's i.e.
> > > xml[1]=<a>1</a>
> > > xml[2]=<a>2</a>...
> >
> >XSLT 2.0 solution:
> >
> ><xsl:template match="a">
> >   <xsl:result-document href="file{position()}.xml">
> >     <xsl:copy-of select="."/>
> >   </xsl:result-document>
> ></xsl:template>
> >
> >Some XSLT 1.0 processors have extensions that do similar things.
> >
> 
> So here, I guess the multiple output xmls are created as 
> files.

Just because it has a URI doesn't mean it's a file! (though that is the
default, of course).

> Is there 
> anyway that the xml's can instead be returned to the java 
> program that 
> called the transformation, so that the program does not have 
> to read them from disk?

This depends on the processor API. Saxon allows you to nominate an
OutputURIResolver which is called to process each result document as it is
written; for example it can supply a SAX ContentHandler which feeds the
output into another transformation.

Michael Kay
http://www.saxonica.com/

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.