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

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


harris41		Sun Jul 14 03:48:49 2002 EDT

  Added files:                 
    /nsdl/lib/stylesheets	dcnsdl_to_loncapa.xsl 
  Log:
  stylesheet for converting dcnsdl to loncapa "qualified" xml
  
  

Index: nsdl/lib/stylesheets/dcnsdl_to_loncapa.xsl
+++ nsdl/lib/stylesheets/dcnsdl_to_loncapa.xsl
<?xml version="1.0"?> 
<xsl:stylesheet
  xmlns:dc="http://purl.org/dc/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="/">
<loncapa:loncapa
 xmlns:loncapa="http://nsdl.lon-capa.org/loncapa/elements/1.1/">
<xsl:text>
</xsl:text>
<xsl:apply-templates select="/*/dc:identifier"/>
<xsl:apply-templates select="/*/dc:title"/>
<xsl:apply-templates select="/*/dc:language"/>
<xsl:apply-templates select="/*/dc:description"/>
<xsl:apply-templates select="/*/dc:subject"/>
<!-- xsl:apply-templates select="/*/dc:coverage"/ -->
<xsl:apply-templates select="/*/dc:creator"/>
<xsl:apply-templates select="/*/dc:publisher"/>
<xsl:apply-templates select="/*/dc:date"/>
<xsl:apply-templates select="/*/dc:format"/>
<!-- xsl:apply-templates select="/*/dc:type"/ -->
<xsl:apply-templates select="/*/dc:rights"/>
<!-- xsl:apply-templates select="/*/dc:source"/ -->
<!-- xsl:apply-templates select="/*/dc:relation"/ -->
</loncapa:loncapa>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="dc:identifier">
<uri>
         <xsl:choose>
           <xsl:when 
         test="function-available('external:dcnsdl_identifier_to_loncapa_uri')"
             >
             <xsl:value-of select=
                               "external:dcnsdl_identifier_to_loncapa_uri(.)"/>
           </xsl:when>
           <xsl:otherwise>
         Function external:dcnsdl_identifier_to_loncapa_uri() is not available!
           </xsl:otherwise>
         </xsl:choose>
</uri>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="dc:title">
<title>
         <xsl:choose>
           <xsl:when
            test="function-available('external:dcnsdl_title_to_loncapa_title')"
             >
             <xsl:value-of select="external:dcnsdl_title_to_loncapa_title(.)"/>
           </xsl:when>
           <xsl:otherwise>
            Function external:dcnsdl_title_to_loncapa_title() is not available!
           </xsl:otherwise>
         </xsl:choose>
</title>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="dc:language">
<language>
         <xsl:choose>
           <xsl:when
      test="function-available('external:dcnsdl_language_to_loncapa_language')"
             >
             <xsl:value-of select=
                            "external:dcnsdl_language_to_loncapa_language(.)"/>
           </xsl:when>
           <xsl:otherwise>
      Function external:dcnsdl_language_to_loncapa_language() is not available!
           </xsl:otherwise>
         </xsl:choose>
</language>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="dc:description">
<abstract>
         <xsl:choose>
           <xsl:when
   test="function-available('external:dcnsdl_description_to_loncapa_abstract')"
             >
             <xsl:value-of select=
                         "external:dcnsdl_description_to_loncapa_abstract(.)"/>
           </xsl:when>
           <xsl:otherwise>
   Function external:dcnsdl_description_to_loncapa_abstract() is not available!
           </xsl:otherwise>
         </xsl:choose>
</abstract>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="dc:subject">
<subject>
         <xsl:choose>
           <xsl:when
        test="function-available('external:dcnsdl_subject_to_loncapa_subject')"
             >
             <xsl:value-of select=
                              "external:dcnsdl_subject_to_loncapa_subject(.)"/>
           </xsl:when>
           <xsl:otherwise>
        Function external:dcnsdl_subject_to_loncapa_subject() is not available!
           </xsl:otherwise>
         </xsl:choose>
</subject>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="dc:creator">
<author>
         <xsl:choose>
           <xsl:when
        test="function-available('external:dcnsdl_creator_to_loncapa_author')"
             >
             <xsl:value-of select=
                               "external:dcnsdl_creator_to_loncapa_author(.)"/>
           </xsl:when>
           <xsl:otherwise>
         Function external:dcnsdl_creator_to_loncapa_author() is not available!
           </xsl:otherwise>
         </xsl:choose>
</author>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="dc:publisher">
<owner>
         <xsl:choose>
           <xsl:when
        test="function-available('external:dcnsdl_publisher_to_loncapa_owner')"
             >
             <xsl:value-of select=
                              "external:dcnsdl_publisher_to_loncapa_owner(.)"/>
           </xsl:when>
           <xsl:otherwise>
        Function external:dcnsdl_publisher_to_loncapa_owner() is not available!
           </xsl:otherwise>
         </xsl:choose>
</owner>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="dc:date">
<lastrevisiondate>
         <xsl:choose>
           <xsl:when
  test="function-available('external:dcnsdl_date_to_loncapa_lastrevisiondate')"
             >
             <xsl:value-of select=
                        "external:dcnsdl_date_to_loncapa_lastrevisiondate(.)"/>
           </xsl:when>
           <xsl:otherwise>
  Function external:dcnsdl_date_to_loncapa_lastrevisiondate() is not available!
           </xsl:otherwise>
         </xsl:choose>
</lastrevisiondate>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="dc:format">
<mime>
         <xsl:choose>
           <xsl:when
            test="function-available('external:dcnsdl_format_to_loncapa_mime')"
             >
             <xsl:value-of select=
                                  "external:dcnsdl_format_to_loncapa_mime(.)"/>
           </xsl:when>
           <xsl:otherwise>
            Function external:dcnsdl_format_to_loncapa_mime() is not available!
           </xsl:otherwise>
         </xsl:choose>
</mime>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="dc:rights">
<copyright>
         <xsl:choose>
           <xsl:when
       test="function-available('external:dcnsdl_rights_to_loncapa_copyright')"
             >
             <xsl:value-of select=
                             "external:dcnsdl_rights_to_loncapa_copyright(.)"/>
           </xsl:when>
           <xsl:otherwise>
       Function external:dcnsdl_rights_to_loncapa_copyright() is not available!
           </xsl:otherwise>
         </xsl:choose>
</copyright>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>