Re: [xsl] Dividing a long document into seperate documents

Subject: Re: [xsl] Dividing a long document into seperate documents
From: "Jay Bryant" <jay@xxxxxxxxxxxx>
Date: Mon, 14 Aug 2006 22:49:08 -0500
Each file name has to be unique. To meet that requirement, you can create
filename strings from bits of data.

Suppose you have 3 RDF elements. Then you might do something like:

<xsl:template match="RDF">
   <xsl:result-document href="{concat('rdf', count(preceding-sibling::RDF) +
1, '.xml')}">
     <xsl:copy-of select="."/>
   </xslresult-document>
</xsl:template>

to get rdf1.xml, rdf2.xml, and rdf3.xml.

Jay Bryant
Bryant Communication Services

----- Original Message ----- 
From: "Choi Ryan" <yutaka234@xxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, August 14, 2006 5:24 PM
Subject: Re: [xsl] Dividing a long document into seperate documents


> Thanks for a good suggestion..
>
> One more question.
>
> What do you mean by "concatenating information within the RDF record"?
>
> Thanks a lot,
>
> Cheers,
> Ryan
>
> >From: "Jay Bryant" <jay@xxxxxxxxxxxx>
> >Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> >Subject: Re: [xsl] Dividing a long document into seperate documents
> >Date: Mon, 14 Aug 2006 16:30:24 -0500
> >
> >If you are using XSLT 2.0, you can chop up a file with xsl:result
> document,
> >thus:
> >
> ><xsl:template match="RDF">
> >   <xsl:result-document href="sometitle">
> >     <xsl:copy-of select="."/>
> >   </xslresult-document>
> ></xsl:template>
> >
> >That will put each RDF element into its own file. Of course, you need to
> >generate the "sometitle" value (probably by concatenating information
> within
> >the RDF record. You could also copy parts of the metadata at the top of
> the
> >source file into the RDF files, if needed.
> >
> >If you are not using XSLT 2.0, you can still do this if you use a
> processor
> >that supports an extension function to write content to a file. I know
> Saxon
> >has such a function, and I bet many other processors do, too.
> >
> >HTH
> >
> >Jay Bryant
> >Bryant Communication Services
> >
> >----- Original Message -----
> >From: "Choi Ryan" <yutaka234@xxxxxxxxxxx>
> >To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> >Sent: Monday, August 14, 2006 4:09 PM
> >Subject: [xsl] Dividing a long document into seperate documents
> >
> >
> > > Hi All,
> > >
> > > Sorry for a long posting.
> > > Actually, I transformed OAI Harvesting documents from XSLT. But, OAI
> XML
> > > Document has multiple bindings as below..
> > >
> > > <uiuc>
> > > <metadata>
> > > <oai_dc:dc xmlns:dc="http://purl.org/dc/elements/1.1/";
> > > xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/";
> > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> > > xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/
> > >               http://www.openarchives.org/OAI/2.0/oai_dc.xsd";>
> > > <dc:title>Oldtown Folks</dc:title>
> > > <dc:creator>Stowe, Harriet Beecher, 1811-1896</dc:creator>
> > > <dc:subject>New England -- Social life and customs --
> >Fiction.</dc:subject>
> > > <dc:subject>Women -- New England -- Fiction.</dc:subject>
> > > <dc:subject>PS2954 .O4</dc:subject>
> > >
>
><dc:identifier>http://digital.library.upenn.edu/women/stowe/folks/folks.htm
l
>
> ></dc:identifier>
> > >
> > > <dc:format>text/html</dc:format>
> > > <dc:description>Boston: Fields, Osgood, and Co., 1869</dc:description>
> > > <dc:publisher>Fields, Osgood, and Co.</dc:publisher>
> > > <dc:date>1869</dc:date>
> > > <dc:publisher>A Celebration of Women Writers</dc:publisher>
> > > <dc:date>2001-01-11</dc:date><dc:type>Text</dc:type>
> > > </oai_dc:dc>
> > > </metadata>
> > > <metadata>
> > > <oai_dc:dc xmlns:dc="http://purl.org/dc/elements/1.1/";
> > > xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/";
> > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> > > xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/
> > >               http://www.openarchives.org/OAI/2.0/oai_dc.xsd";>
> > > <dc:title>An Island Garden</dc:title>
> > > <dc:creator>Thaxter, Celia, 1835-1894</dc:creator>
> > > <dc:creator>Hassam, Childe</dc:creator>
> > > <dc:subject>Celia Thaxter's Garden (Appledore Island,
> Me.).</dc:subject>
> > > <dc:subject>Thaxter, Celia, 1835-1894.</dc:subject>
> > > <dc:subject>Gardens -- Maine -- Appledore Island.</dc:subject>
> > > <dc:subject>Appledore Island (Me.) -- Description and
> travel.</dc:subject>
> > > <dc:subject>SB466 .U6 T5</dc:subject>
> > >
>
><dc:identifier>http://digital.library.upenn.edu/women/thaxter/garden/garden
.
>
> >html</dc:identifier>
> > >
> > > <dc:format>text/html</dc:format>
> > > <dc:publisher>A Celebration of Women Writers</dc:publisher>
> > > <dc:date>2001-07-13</dc:date><dc:type>Text</dc:type>
> > > </oai_dc:dc>
> > > </metadata><metadata>...</metadata><metadata>...</metadata>..</uiuc>
> > >
> > > So, my transformation also has multiple buildings as below. However,
> > > actually, each rdf binding is seperate record. However, I do not have
> any
> > > idea how to handle seperating this into seperate records. Could you
> give
> >me
> > > a tip or help?
> > >
> > > <rdf:RDF xmlns:content="http://purl.org/rss/1.0/modules/content/";
> > > xmlns:dc="http://purl.org/dc/elements/1.1/";
> > > xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/";
> > > xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
> > > xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";
> > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
> > > <rdf:Description
> > >
> rdf:about="http://digital.library.upenn.edu/women/stowe/folks/folks.html";>
> > > <rdf:type rdf:resource="http://purl.org/gem/qualifiers/GEM2"/>
> > > <dc:identifier
> > >
>
>rdf:resource="http://digital.library.upenn.edu/women/stowe/folks/folks.html
"
>
> >/>
> > >
> > > <dc:title>Oldtown Folks</dc:title>
> > > <dc:creator>Stowe, Harriet Beecher, 1811-1896</dc:creator>
> > > <dc:subject>New England -- Social life and customs --
> > > Fiction.</dc:subject>
> > > <dc:subject>Women -- New England -- Fiction.</dc:subject>
> > > <dc:subject>PS2954 .O4</dc:subject>
> > > <dc:format>text/html</dc:format>
> > > <dc:description>Boston: Fields, Osgood, and Co., 1869</dc:description>
> > > <dc:publisher>Fields, Osgood, and Co.</dc:publisher>
> > > <dc:publisher>A Celebration of Women Writers</dc:publisher>
> > > <dc:date>1869</dc:date>
> > > <dc:date>2001-01-11</dc:date>
> > > <dc:type>Text</dc:type>
> > > </rdf:Description>
> > > </rdf:RDF>
> > > <rdf:RDF xmlns:content="http://purl.org/rss/1.0/modules/content/";
> > > xmlns:dc="http://purl.org/dc/elements/1.1/";
> > > xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/";
> > > xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
> > > xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";
> > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
> > > <rdf:Description
> > >
>
>rdf:about="http://digital.library.upenn.edu/women/thaxter/garden/garden.htm
l
>
> >">
> > >
> > > <rdf:type rdf:resource="http://purl.org/gem/qualifiers/GEM2"/>
> > > <dc:identifier
> > >
>
>rdf:resource="http://digital.library.upenn.edu/women/thaxter/garden/garden.
h
>
> >tml"/>
> > >
> > > <dc:title>An Island Garden</dc:title>
> > > <dc:creator>Thaxter, Celia, 1835-1894</dc:creator>
> > > <dc:creator>Hassam, Childe</dc:creator>
> > > <dc:subject>Celia Thaxter's Garden (Appledore Island,
> Me.).</dc:subject>
> > > <dc:subject>Thaxter, Celia, 1835-1894.</dc:subject>
> > > <dc:subject>Gardens -- Maine -- Appledore Island.</dc:subject>
> > > <dc:subject>Appledore Island (Me.) -- Description and
> > > travel.</dc:subject>
> > > <dc:subject>SB466 .U6 T5</dc:subject>
> > > <dc:format>text/html</dc:format>
> > > <dc:publisher>A Celebration of Women Writers</dc:publisher>
> > > <dc:date>2001-07-13</dc:date>
> > > <dc:type>Text</dc:type>
> > > </rdf:Description>
> > > </rdf:RDF>
> > > <rdf:RDF>...</rdf:RDF><rdf:RDF>...</rdf:RDF><rdf:RDF>...</rdf:RDF>
> > >
> > > Thanks a lot,
> > >
> > > Cheers,
> > > Ryan
> > >
> > > _________________________________________________________________
> > > C%;s@'?! 4Y8. ?C8.0m 4@1_GO0T Aq1d4Y... MSN ?B6s@N ;s?50|
> > > http://vod.msn.co.kr
> >
>
> _________________________________________________________________
> Au1G A$:8 0!@e :|8#0m FmGO0T :8=G <v @V=@4O4Y. MSN Au1G/Eu@Z
> http://www.msn.co.kr/stock/

Current Thread