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

Re: Dividing a long document into seperate documents

Subject: Re: Dividing a long document into seperate documents
From: "Choi Ryan" <yutaka234@xxxxxxxxxxx>
Date: Wed, 16 Aug 2006 06:03:55 +0900
choi gem
Hi,

Thanks for good suggestion.

Based on your suggestion, I tried to modify xslt. But, it only generate one rdf document (rdf1.rdf). Could you take a look at my xslt? and suggest some tips to create multiple files from it.

Appreciate it advance,

My XSLT: <?xml version="1.0"?>

<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" >

<xsl:output encoding="UTF-8" method="xml" indent="yes" />

<xsl:template match="uiuc">
<xsl:for-each select="metadata/oai_dc:dc">
<xsl:result-document href="{concat('rdf', count(preceding-sibling::RDF) +1, '.rdf')}">


<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/">

<xsl:variable name="identifier">
<xsl:value-of select="normalize-space(dc:identifier)"/>
</xsl:variable>
<rdf:Description>
<xsl:attribute name="rdf:about"><xsl:value-of select="$identifier"/></xsl:attribute>
<rdf:type rdf:resource="http://purl.org/gem/qualifiers/GEM2"/>
<xsl:apply-templates select="dc:identifier"/>
<xsl:apply-templates select="dc:title"/>
<xsl:apply-templates select="dc:creator"/>
<xsl:apply-templates select="dc:subject"/>
<xsl:apply-templates select="dc:format"/>
<xsl:apply-templates select="dc:description"/>
<xsl:apply-templates select="dc:publisher"/>
<xsl:apply-templates select="dc:date"/>
<xsl:apply-templates select="dc:type"/>
<xsl:apply-templates select="dc:contributor"/>
<xsl:apply-templates select="dc:coverage"/>
<xsl:apply-templates select="dc:rights"/>
<xsl:apply-templates select="dc:language"/>
<xsl:apply-templates select="dc:relation"/>
<xsl:apply-templates select="dc:source"/>
</rdf:Description>
</rdf:RDF> </xsl:result-document></xsl:for-each>
</xsl:template>


<xsl:template match="dc:identifier"> <dc:identifier rdf:resource="{normalize-space(.)}"/> </xsl:template>
<xsl:template match="dc:title">
<dc:title>
<xsl:value-of select="normalize-space(.)"/>
</dc:title>
</xsl:template><xsl:template match......



Cheers, Ryan

From: "Jay Bryant" <jay@xxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re:  Dividing a long document into seperate documents
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:  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: 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: 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/


_________________________________________________________________
:84Y :|8#0m :81b FmGQ 4:=:. ?@4C@G H-A&4B MSN 4:=:?!<- H.@NGO<<?d. http://www.msn.co.kr/news/


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.