I'm trying to write a stylesheet that outputs prefixed tags. I
keep on getting errors telling me that the prefixes are not bound.
Below is the stylesheet. It invariably fails saying that "The prefix dc
for element <dc:Title> is not bound". As far as I can tell, the text
<dc:Title> should just be output in the results. What am I doing wrong?
+++++++++++++++++++++++++++++++++++++++++++++++++++
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- This stylesheet follows suggestions found in
http://www.loc.gov/standards/mods/mods-dcsimple.html -->
<!--
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:mets="http://www.loc.gov/METS/"
xmlns:mods="http://www.loc.gov/mods/v3"
extension-element-prefixes="mets mods"
exclude-result-prefixes="mets mods">
<xsl:output method="xml" encoding="iso-8859-1" indent="yes" />
<xsl:variable name="dmnodes"
select="mets:mets/mets:structMap/mets:div/@DMDID"/>
<xsl:template match="mets:mets">
<record>
<header>
<!-- An ark will be generated for each METS doc and mapped to
the METS file name. A Java routine called here will retrieve the
identifer from noid -->
<identifier> </identifier>
<!-- Datestamps in METS headers will be in local time. A Java
routine called here will convert to UTC -->
<datestamp><xsl:value-of select="metsHdr/lastmoddate"/></datestamp>
</header>
<metadata>
<oai_dc:dc
xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
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">
<xsl:comment>Going through the for-each</xsl:comment>
<xsl:for-each select="id($dmnodes)"><xsl:apply-templates
select="mets:mdWrap" /></xsl:for-each>
</oai_dc:dc>
</metadata>
</record>
</xsl:template>
<xsl:template
match="mets:xmlData/mods:mods/mods:titleInfo/mods:title">
<dc:Title>
<xsl:value-of select="."/>
</dc:Title>
</xsl:template>
</xsl:stylesheet>
************************************************************************
Any help appreciated;
Garey Mills
"It is only necessary to designate a namespace as an extension element
namespace to distinguish extension elements from literal result
elements" (pg. 282). The <dc:Title> tag is supposed to be a literal
result element. And why isn't it necessary for the <oai_dc:dc ...>
tag, which is also a literal result element? I'm not going to get very
far if I don't understand this.
Thanks again;
Garey Mills
That makes sense. Thanks.
Garey Mills