Primary template match¶
After your identity transform, add a primary template that tells the processor where your metadata records are.
<!-- match metadata -->
<xsl:template match="lyncode:metadata">
</xsl:template>
Inside our main template match we will start serializing our final document.
<xsl:template match="lyncode:metadata">
<!-- match the document root and return a MODS record -->
<mods xmlns="http://www.loc.gov/mods/v3" version="3.5"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-5.xsd">
</mods>
</xsl:template>
Finally, we will call other templates throughout our main template.
<xsl:template match="lyncode:metadata">
<!-- match the document root and return a MODS record -->
<mods xmlns="http://www.loc.gov/mods/v3" version="3.5"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.loc.gov/mods/v3 http://www.loc.gov/standards/mods/v3/mods-3-5.xsd">
<!-- title-->
<xsl:apply-templates select="element[@name = 'dc']/element[@name = 'title']/element/field"/>
<!-- rights-->
<xsl:choose>
<xsl:when test="element[@name = 'dc']/element[@name = 'rights']/element/field">
<xsl:apply-templates select="element[@name = 'dc']/element[@name = 'rights']/element/field"/>
</xsl:when>
<xsl:otherwise>
<accessCondition type="local rights statement">All rights reserved. The accompanying
digital object and its associated documentation are provided for online research and
access purposes. Permission to use, copy, modify, distribute and present this
digital object and the accompanying documentation, without fee, and without written
agreement, is hereby granted for educational, non-commercial purposes only. The
Rhodes College Archives reserves the right to decide what constitutes educational
and commercial use; commercial users may be charged a nominal fee to be determined
by current, commercial rates for use of special materials. In all instances of use,
acknowledgement must begiven to Rhodes College Archives and Special Collection,
Memphis, TN. For information regarding permission to use this image, please email
the Archives at archives@rhodes.edu or call 901-843-3334.</accessCondition>
</xsl:otherwise>
</xsl:choose>
<!-- urls -->
<location>
<xsl:apply-templates select='element[@name = "dc"]/element[@name = "identifier"]/element[@name = "uri"]/element[@name = "none"]/field[@name = "value"]'/>
<xsl:apply-templates select='element[@name="bundles"]/element[@name="bundle"][field[@name="name"][text()="THUMBNAIL"]]/element[@name="bitstreams"]/element[@name="bitstream"][1]/field[@name="url"]'/>
</location>
</mods>
</xsl:template>