Subject: Re: [xsl] using xsl:result-document in a non-list situation From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx> Date: Tue, 19 Aug 2008 19:34:27 +0100 |
2008/8/19 Mark Wilson <mark@xxxxxxxxxxxx>: > All of the examples for using <xsl:result-document> to produce multiple > files (at least those that I've seen) write to a new file each time they > encounter a new instance of a controlling element structure in a 'list' and > use "position()" to help name the file. What technique do I apply to a > document containing a <List> of <Items> such as the one shown below? Here > the controlling element is not simply another <Year> element, but <Year> > elements with differing content: 1998, 1999 and so on, with each year > repeated within the source document many times. Ideally, the output would > be a series of files, one for each different <Year> content (1998.xml, > 1999.xml) and each sorted internally by <IssueNumber> and <Page>. > > I have not been able to see how the stylesheet should be constructed. Any > hints would be appreciated. > Thanks, > Mark > > Source example: > <List> > <Item> > <Data> > ... > </Data> > <Article> > <Year>1999</Year> > <IssueNumber>1</IssueNumber> > <Page>6</Page> > </Article> > </Item> > <Item> > ....... > </Item> > </List> How about: <xsl:for-each-group select="Item" group-by="Article/Year"> <xsl:result-document href="{current-grouping-key()}.ext"> <xsl:for-each select="current-group()"> <xsl:sort select="Article/IssueNumber" data-type="number"/> <xsl:sort select="Article/Page" data-type="number"/> ...... cheers -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] using xsl:result-document in , Mark Wilson | Thread | Re: [xsl] using xsl:result-document, Mark Wilson |
[xsl] using xsl:result-document in , Mark Wilson | Date | Re: [xsl] using xsl:result-document, Mark Wilson |
Month |