3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:pgterms="http://www.gutenberg.org/rdfterms/"
5 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
6 xmlns:dcterms="http://purl.org/dc/terms/"
7 xmlns:dc="http://purl.org/dc/elements/1.1/"
8 exclude-result-prefixes="pgterms rdf dcterms">
10 <xsl:output method="xml" indent="yes"/>
12 <!-- Record element -->
13 <xsl:template match="/pgterms:etext">
15 xmlns:srw_dc="info:srw/schema/1/dc-schema"
16 xmlns:dc="http://purl.org/dc/elements/1.1/"
17 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
18 xsi:schemaLocation="info:srw/schema/1/dc-schema
19 http://www.loc.gov/standards/sru/dc-schema.xsd">
21 <!-- Generate GP permalink -->
23 <xsl:text>http://www.gutenberg.org/etext/</xsl:text>
24 <xsl:value-of select="substring(@rdf:ID, 6)"/>
27 <xsl:apply-templates/>
32 <!-- Ignore other elements by mapping into empty DOM XML trees -->
33 <xsl:template match="/*"/>
35 <!-- Any DC element (except special cases below -->
36 <xsl:template match="/pgterms:etext/*[namespace-uri() = 'http://purl.org/dc/elements/1.1/']">
38 <xsl:when test="rdf:Bag">
39 <xsl:variable name="myname" select="name()"/>
40 <xsl:for-each select="rdf:Bag/*">
41 <xsl:call-template name="cond-display">
42 <xsl:with-param name="name" select="$myname"/>
43 <xsl:with-param name="value" select="."/>
48 <xsl:call-template name="cond-display">
49 <xsl:with-param name="name" select="name()"/>
50 <xsl:with-param name="value" select="."/>
56 <!-- Display this element only if we know and like what kind of content it has -->
57 <xsl:template name="cond-display">
58 <xsl:param name="name"/>
59 <xsl:param name="value"/>
62 <xsl:when test="$value/text()">
63 <xsl:element name="{$name}">
64 <xsl:value-of select="normalize-space($value)"/>
69 <xsl:when test="dcterms:LCSH or dcterms:W3CDTF or dcterms:ISO639-2">
70 <xsl:element name="{$name}">
71 <xsl:value-of select="normalize-space($value)"/>
75 <unknown-type name="{$name}" type="{local-name($value/*)}">
76 <xsl:value-of select="normalize-space($value)"/>
84 <xsl:template match="//dc:rights">
86 <xsl:value-of select="@rdf:resource"/>
90 <!-- This is hardly a DC element -->
91 <xsl:template match="//dc:tableOfContents">
93 <xsl:value-of select="."/>
97 <xsl:template match="text()"/>