[LON-CAPA-cvs] cvs: nsdl /lib/stylesheets loncapa_to_dcnsdl.xsl

harris41 lon-capa-cvs@mail.lon-capa.org
Sun, 14 Jul 2002 07:49:32 -0000


harris41		Sun Jul 14 03:49:32 2002 EDT

  Added files:                 
    /nsdl/lib/stylesheets	loncapa_to_dcnsdl.xsl 
  Log:
  stylesheet for converting loncapa "qualified" metadata to dublin core
  (NSDL-ish) metadata
  
  

Index: nsdl/lib/stylesheets/loncapa_to_dcnsdl.xsl
+++ nsdl/lib/stylesheets/loncapa_to_dcnsdl.xsl
<?xml version="1.0"?> 
<xsl:stylesheet
  xmlns:loncapa="http://nsdl.lon-capa.org/loncapa/elements/1.1/"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  xmlns:external="http://nsdl.lon-capa.org/namespace/ExternalFunction/"
>
<xsl:template match="/">
<dc:dc xmlns:dc="http://purl.org/dc/elements/1.1/">
<xsl:text>
</xsl:text>
<!-- xsl:apply-templates select="/*/loncapa:*"/ -->
<xsl:apply-templates select="/*/loncapa:title"/>
<xsl:apply-templates select="/*/loncapa:author"/>
<xsl:apply-templates select="/*/loncapa:owner"/>
<xsl:apply-templates select="/*/loncapa:subject"/>
<xsl:apply-templates select="/*/loncapa:abstract"/>
<xsl:apply-templates select="/*/loncapa:lastrevisiondate"/>
<xsl:apply-templates select="/*/loncapa:mime"/>
<xsl:apply-templates select="/*/loncapa:uri"/>
<xsl:apply-templates select="/*/loncapa:language"/>
<xsl:apply-templates select="/*/loncapa:copyright"/>
<dc:relation>[unknown]</dc:relation>
<xsl:text>
</xsl:text>
<dc:source>[unknown]</dc:source>
<xsl:text>
</xsl:text>
<dc:coverage>[unknown]</dc:coverage>
<xsl:text>
</xsl:text>
<xsl:apply-templates select="/*/loncapa:copyright"/>
</dc:dc>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="loncapa:title">
<dc:title>
         <xsl:choose>
           <xsl:when
                 test=
                 "function-available('external:loncapa_title_to_dcnsdl_title')"
             >
             <xsl:value-of select="external:loncapa_title_to_dcnsdl_title(.)"/>
           </xsl:when>
           <xsl:otherwise>
            Function external:loncapa_title_to_dcnsdl_title() is not available!
           </xsl:otherwise>
         </xsl:choose>
</dc:title>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="loncapa:author">
<dc:contributor>
         <xsl:choose>
           <xsl:when
                 test=
          "function-available('external:loncapa_author_to_dcnsdl_contributor')"
             >
             <xsl:value-of
                    select="external:loncapa_author_to_dcnsdl_contributor(.)"/>
           </xsl:when>
           <xsl:otherwise>
     Function external:loncapa_author_to_dcnsdl_contributor() is not available!
           </xsl:otherwise>
         </xsl:choose>
</dc:contributor>
<xsl:text>
</xsl:text>
<dc:creator>
         <xsl:choose>
           <xsl:when
                 test=
              "function-available('external:loncapa_author_to_dcnsdl_creator')"
             >
             <xsl:value-of
                        select="external:loncapa_author_to_dcnsdl_creator(.)"/>
           </xsl:when>
           <xsl:otherwise>
         Function external:loncapa_author_to_dcnsdl_creator() is not available!
           </xsl:otherwise>
         </xsl:choose>
</dc:creator>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="loncapa:owner">
<dc:publisher>
         <xsl:choose>
           <xsl:when
                 test=
             "function-available('external:loncapa_owner_to_dcnsdl_publisher')"
             >
             <xsl:value-of
                       select="external:loncapa_owner_to_dcnsdl_publisher(.)"/>
           </xsl:when>
           <xsl:otherwise>
        Function external:loncapa_owner_to_dcnsdl_publisher() is not available!
           </xsl:otherwise>
         </xsl:choose>
</dc:publisher>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="loncapa:subject">
<dc:subject>
         <xsl:choose>
           <xsl:when
                 test=
             "function-available('external:loncapa_subject_to_dcnsdl_subject')"
             >
           <xsl:value-of
                       select="external:loncapa_subject_to_dcnsdl_subject(.)"/>
           </xsl:when>
           <xsl:otherwise>
        Function external:loncapa_subject_to_dcnsdl_subject() is not available!
           </xsl:otherwise>
         </xsl:choose>
</dc:subject>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="loncapa:abstract">
<dc:description>
         <xsl:choose>
           <xsl:when
                 test=
        "function-available('external:loncapa_abstract_to_dcnsdl_description')"
             >
             <xsl:value-of
                  select="external:loncapa_abstract_to_dcnsdl_description(.)"/>
           </xsl:when>
           <xsl:otherwise>
   Function external:loncapa_abstract_to_dcnsdl_description() is not available!
           </xsl:otherwise>
         </xsl:choose>
</dc:description>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="loncapa:lastrevisiondate">
<date>
         <xsl:choose>
           <xsl:when
                 test=
       "function-available('external:loncapa_lastrevisiondate_to_dcnsdl_date')"
             >
             <xsl:value-of select=
                        "external:loncapa_lastrevisiondate_to_dcnsdl_date(.)"/>
           </xsl:when>
           <xsl:otherwise>
  Function external:loncapa_lastrevisiondate_to_dcnsdl_date() is not available!
           </xsl:otherwise>
         </xsl:choose>
</date>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="loncapa:mime">
<dc:type>
         <xsl:choose>
           <xsl:when
                 test=
                   "function-available('external:loncapa_mime_to_dcnsdl_type')"
             >
             <xsl:value-of select="external:loncapa_mime_to_dcnsdl_type(.)"/>
           </xsl:when>
           <xsl:otherwise>
              Function external:loncapa_mime_to_dcnsdl_type() is not available!
           </xsl:otherwise>
         </xsl:choose>
</dc:type>
<xsl:text>
</xsl:text>
<dc:format>
         <xsl:choose>
           <xsl:when
                 test=
                 "function-available('external:loncapa_mime_to_dcnsdl_format')"
             >
             <xsl:value-of select="external:loncapa_mime_to_dcnsdl_format(.)"/>
           </xsl:when>
           <xsl:otherwise>
            Function external:loncapa_mime_to_dcnsdl_format() is not available!
           </xsl:otherwise>
         </xsl:choose>
</dc:format>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="loncapa:uri">
<dc:identifier>
         <xsl:choose>
           <xsl:when
                 test=
              "function-available('external:loncapa_uri_to_dcnsdl_identifier')"
             >
             <xsl:value-of select=
                               "external:loncapa_uri_to_dcnsdl_identifier(.)"/>
           </xsl:when>
           <xsl:otherwise>
         Function external:loncapa_uri_to_dcnsdl_identifier() is not available!
           </xsl:otherwise>
         </xsl:choose>
</dc:identifier>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="loncapa:language">
<dc:language>
         <xsl:choose>
           <xsl:when
                 test=
           "function-available('external:loncapa_language_to_dcnsdl_language')"
             >
             <xsl:value-of select=
                            "external:loncapa_language_to_dcnsdl_language(.)"/>
           </xsl:when>
           <xsl:otherwise>
      Function external:loncapa_language_to_dcnsdl_language() is not available!
           </xsl:otherwise>
         </xsl:choose>
</dc:language>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="loncapa:copyright">
<dc:rights>
         <xsl:choose>
           <xsl:when
                 test=
            "function-available('external:loncapa_copyright_to_dcnsdl_rights')"
             >
             <xsl:value-of select=
                            "external:loncapa_copyright_to_dcnsdl_rights(.)"/>
           </xsl:when>
           <xsl:otherwise>
       Function external:loncapa_copyright_to_dcnsdl_rights() is not available!
           </xsl:otherwise>
         </xsl:choose>
</dc:rights>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>