[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: Thu, 17 Aug 2006 02:28:39 +0900
Re:  Dividing a long document into seperate documents
Um. It is kind of weired. Your suggestion works for a similar example, but not in this xslt. Have no idea why...

Any idea??

Here is my xslt... and my xml files.. Any suggestion???

XSLT:
<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::oai_dc:dc) +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="dc:creator">
<dc:creator>
<xsl:value-of select="normalize-space(.)"/>
</dc:creator>
</xsl:template>

<xsl:template match="dc:subject">
<dc:subject>
<xsl:value-of select="normalize-space(.)"/>
</dc:subject>
</xsl:template>

<xsl:template match="dc:format">
<dc:format>
<xsl:value-of select="normalize-space(.)"/>
</dc:format>
</xsl:template>

<xsl:template match="dc:description">
<dc:description>
<xsl:value-of select="normalize-space(.)"/>
</dc:description>
</xsl:template>

<xsl:template match="dc:publisher">
<dc:publisher>
<xsl:value-of select="normalize-space(.)"/>
</dc:publisher>
</xsl:template>

<xsl:template match="dc:date">
<dc:date>
<xsl:value-of select="normalize-space(.)"/>
</dc:date>
</xsl:template>

<xsl:template match="dc:type">
<dc:type>
<xsl:value-of select="normalize-space(.)"/>
</dc:type>
</xsl:template>

<xsl:template match="dc:contributor">
<dc:contributor>
<xsl:value-of select="normalize-space(.)"/>
</dc:contributor>
</xsl:template>

<xsl:template match="dc:coverage">
<dc:coverage>
<xsl:value-of select="normalize-space(.)"/>
</dc:coverage>
</xsl:template>

<xsl:template match="dc:language">
<dc:language>
<xsl:value-of select="normalize-space(.)"/>
</dc:language>
</xsl:template>

<xsl:template match="dc:rights">
<dc:rights>
<xsl:value-of select="normalize-space(.)"/>
</dc:rights>
</xsl:template>

<xsl:template match="dc:relation">
<dc:relation>
<xsl:value-of select="normalize-space(.)"/>
</dc:relation>
</xsl:template>

<xsl:template match="dc:source">
<dc:source>
<xsl:value-of select="normalize-space(.)"/>
</dc:source>
</xsl:template>

</xsl:stylesheet>



My xml file:


<?xml-stylesheet type="text/xsl" href="uiuc_item.xsl"?>
<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.html</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>
</uiuc>



From: "Jay Bryant" <jay@xxxxxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re:  Dividing a long document into seperate documents
Date: Tue, 15 Aug 2006 16:53:57 -0500

The reason it's creating just one record is because it's counting up the
preceding-sibling axis. As it happens, the metadata elements have no RDF
elements as preceding siblings, so it never gets anywhere. If you're
trying
to create an RDF file for each metadata/oai_dc:dc element, then count
those
elements, thus:

<xsl:for-each select="metadata/oai_dc:dc">
  <xsl:result-document href="{concat('rdf',
count(preceding-sibling::oai_dc:dc) +1, '.rdf')}">
    <!-- Snipped the other processing -->
  </xsl:result-document>
</xsl:for-each>

HTH

Jay Bryant
Bryant Communication Services


_________________________________________________________________
MSN Messenger8& EkGX ?B6s@N;s?! @V4B D#18?M 4kH-8& 3*4)<<?d. http://messenger.msn.co.kr


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.