Commits

btingle committed 46903f0

copy container/@label to physdesc

  • Participants
  • Parent commits e6ccb72

Comments (0)

Files changed (2)

 
 - converts the country code to uppercase as per the schema
 
-- strips out label attributes on container elements because they are
-  not really labels
+- turns did/container/@label to did/physdesc
+  
 
 Produced by the California Digital Library, Digital Special Collections
 	http://www.cdlib.org/services/dsc/
 <xsl:stylesheet 
   version="1.0" 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-  xmlns:ead="urn:isbn:1-931666-22-9">
+  xmlns:ead="urn:isbn:1-931666-22-9"
+  xmlns="urn:isbn:1-931666-22-9">
 
 <xsl:param name="dsc-type" select="'combined'"/>
 <xsl:param name="repositorycode" select="/ead:ead/ead:eadheader/ead:eadid/@mainagencycode"/>
 		/ead:ead/ead:eadheader/ead:eadid/@countrycode,
 		'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' )" />
 
+<xsl:param name="namespace" select="'urn:isbn:1-931666-22-9'"/>
+
 <!-- root template -->
 <xsl:template match="/|comment()|processing-instruction()">
     <xsl:copy>
 
 <!-- add dsc/@type -->
 <xsl:template match="ead:dsc[parent::ead:archdesc and position()=1]">
-  <xsl:element name="{name()}">
+  <xsl:element name="{name()}" namespace="{$namespace}">
     <xsl:apply-templates select="@*"/>
     <xsl:if test="not(@type) and $dsc-type!=''">
       <xsl:attribute name="type">
      archdesc/did/unittitle
 -->
 <xsl:template match="ead:unitid[parent::ead:did and not(ancestor::ead:dsc)]">
-  <xsl:element name="{name()}">
+  <xsl:element name="{name()}" namespace="{$namespace}">
     <xsl:apply-templates select="@*"/>
     <xsl:if test="not(@repositorycode) and $repositorycode!=''">
       <xsl:attribute name="repositorycode">
 </xsl:template>
 
 <!-- strip out overloaded container labels -->
-<xsl:template match="@label[local-name(..)='container']"/>
+<xsl:template match="ead:container[@label]">
+  <xsl:element name="{name()}" namespace="{$namespace}">
+    <xsl:apply-templates select="@*[name()!='label']"/>
+    <xsl:apply-templates/>
+  </xsl:element>
+  <xsl:element name="physdesc" namespace="{$namespace}">
+    <xsl:value-of select="@label"/>
+  </xsl:element>
+</xsl:template>
 
 <!-- identity -->
 <xsl:template match="@*|node()">