File:  [LON-CAPA] / nsdl / lib / stylesheets / loncapa_to_lomnsdl.xsl
Revision 1.1: download - view: text, annotated - select for diffs
Sun Jul 14 07:51:43 2002 UTC (21 years, 9 months ago) by harris41
Branches: MAIN
CVS tags: HEAD
stylesheet for converting loncapa "qualified" xml to IEEE LOM (where
the dtd approximates what LTSC will hopefully someday release)

<?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="/">
<!-- These values are stored in memory (converter_INFO) -->
<xsl:apply-templates select="/*/loncapa:language"/>
<xsl:apply-templates select="/*/loncapa:author"/>
<xsl:apply-templates select="/*/loncapa:lastrevisiondate"/>
<xsl:apply-templates select="/*/loncapa:metauri"/>
<xsl:apply-templates select="/*/loncapa:copyright"/>
<xsl:apply-templates select="/*/loncapa:owner"/>
<lom:lom xmlns:lom="http://nsdl.lon-capa.org/lom/elements/6.4/">
<xsl:text>
</xsl:text>
<General>
 <Identifier>
  <Catalog>LON</Catalog>
         <xsl:choose>
           <xsl:when
                 test=
         "function-available('external:converter_INFO_to_lomnsdl_GeneralIdentifierEntry')"
             >
     <xsl:value-of select="external:converter_INFO_to_lomnsdl_GeneralIdentifierEntry(.)"/>
           </xsl:when>
           <xsl:otherwise>
Function external:converter_INFO_to_lomnsdl_GeneralIdentifierEntry() is not
available!
           </xsl:otherwise>
         </xsl:choose>
 </Identifier>
 <xsl:apply-templates select="/*/loncapa:title"/>
         <xsl:choose>
           <xsl:when
                 test=
         "function-available('external:converter_INFO_to_lomnsdl_GeneralLanguage')"
             >
     <xsl:value-of select="external:converter_INFO_to_lomnsdl_GeneralLanguage(.)"/>
           </xsl:when>
           <xsl:otherwise>
    Function external:converter_INFO_to_lomnsdl_GeneralLanguage() is not available!
           </xsl:otherwise>
         </xsl:choose>
 <xsl:apply-templates select="/*/loncapa:abstract"/>
 <xsl:apply-templates select="/*/loncapa:keywords"/>
 <xsl:apply-templates select="/*/loncapa:structure"/>
 <xsl:apply-templates select="/*/loncapa:aggregation"/>
</General>

<LifeCycle>
 <xsl:apply-templates select="/*/loncapa:version"/>
 <Contribute>
 <Role>author</Role>
 <Entity>
         <xsl:choose>
           <xsl:when
                 test=
      "function-available('external:converter_INFO_to_lomnsdl_LifeCycleContributeEntity')"
             >
     <xsl:value-of select="external:converter_INFO_to_lomnsdl_LifeCycleContributeEntity(.)"/>
           </xsl:when>
           <xsl:otherwise>
    Function external:converter_INFO_to_lomnsdl_LifeCycleContributeEntity() is not available!
           </xsl:otherwise>
         </xsl:choose>
 </Entity>
 <Date>
         <xsl:choose>
           <xsl:when
                 test=
         "function-available('external:converter_INFO_to_lomnsdl_LifeCycleContributeDate')"
             >
     <xsl:value-of select="external:converter_INFO_to_lomnsdl_LifeCycleContributeDate(.)"/>
           </xsl:when>
           <xsl:otherwise>
    Function external:converter_INFO_to_lomnsdl_LifeCycleContributeDate() is not available!
           </xsl:otherwise>
         </xsl:choose>
 </Date>
 </Contribute>
</LifeCycle>

<MetaMetadata>
         <xsl:choose>
           <xsl:when
                 test=
        "function-available('external:converter_INFO_to_lomnsdl_MetaMetadata')"
             >
    <xsl:value-of select="external:converter_INFO_to_lomnsdl_MetaMetadata(.)"/>
           </xsl:when>
           <xsl:otherwise>
   Function external:converter_INFO_to_lomnsdl_MetaMetadata() is not available!
           </xsl:otherwise>
         </xsl:choose>
</MetaMetadata>

<Technical>
 <xsl:apply-templates select="/*/loncapa:mime"/>
 <xsl:apply-templates select="/*/loncapa:bytesize"/>
 <Location>
         <xsl:choose>
           <xsl:when
                 test=
   "function-available('external:converter_INFO_to_lomnsdl_TechnicalLocation')"
             >
             <xsl:value-of 
             select="external:converter_INFO_to_lomnsdl_TechnicalLocation(.)"/>
           </xsl:when>
           <xsl:otherwise>
   Function external:converter_INFO_to_lomnsdl_TechnicalLocation() is not
available!
           </xsl:otherwise>
         </xsl:choose>
 </Location>
 <Requirement>
         <xsl:choose>
           <xsl:when
                 test=
"function-available('external:converter_INFO_to_lomnsdl_TechnicalRequirement')"
             >
             <xsl:value-of 
          select="external:converter_INFO_to_lomnsdl_TechnicalRequirement(.)"/>
           </xsl:when>
           <xsl:otherwise>
   Function external:converter_INFO_to_lomnsdl_TechnicalRequirement() is not
available!
           </xsl:otherwise>
         </xsl:choose>
 </Requirement>
</Technical>

<Educational>
 <xsl:apply-templates select="/*/loncapa:notes"/>
 <Language>
         <xsl:choose>
           <xsl:when
                 test=
"function-available('external:converter_INFO_to_lomnsdl_EducationalLanguage')"
             >
             <xsl:value-of 
          select="external:converter_INFO_to_lomnsdl_EducationalLanguage(.)"/>
           </xsl:when>
           <xsl:otherwise>
   Function external:converter_INFO_to_lomnsdl_EducationalLanguage() is not
available!
           </xsl:otherwise>
         </xsl:choose>
 </Language>
</Educational>

<Rights>
 <CopyrightandOtherRestrictions>yes</CopyrightandOtherRestrictions>
 <Description>
         <xsl:choose>
           <xsl:when
                 test=
"function-available('external:converter_INFO_to_lomnsdl_RightsDescription')"
             >
             <xsl:value-of 
          select="external:converter_INFO_to_lomnsdl_RightsDescription(.)"/>
           </xsl:when>
           <xsl:otherwise>
         Function external:converter_INFO_to_lomnsdl_RightsDescription() is not
available!
           </xsl:otherwise>
         </xsl:choose>
 </Description>
</Rights>
<xsl:text>
</xsl:text>

</lom:lom>
</xsl:template>
<xsl:template match="loncapa:title">
<Title>
         <xsl:choose>
           <xsl:when
                 test=
         "function-available('external:loncapa_title_to_lomnsdl_GeneralTitle')"
             >
     <xsl:value-of select="external:loncapa_title_to_lomnsdl_GeneralTitle(.)"/>
           </xsl:when>
           <xsl:otherwise>
    Function external:loncapa_title_to_lomnsdl_GeneralTitle() is not available!
           </xsl:otherwise>
         </xsl:choose>
</Title>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="loncapa:abstract">
<Description>
         <xsl:choose>
           <xsl:when
                 test=
"function-available('external:loncapa_abstract_to_lomnsdl_GeneralDescription')"
             >
     <xsl:value-of select=
                 "external:loncapa_abstract_to_lomnsdl_GeneralDescription(.)"/>
           </xsl:when>
           <xsl:otherwise>
    Function external:loncapa_abstract_to_lomnsdl_GeneralDescription() is not
available!
           </xsl:otherwise>
         </xsl:choose>
</Description>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="loncapa:keywords">
<Keyword>
         <xsl:choose>
           <xsl:when
                 test=
"function-available('external:loncapa_keywords_to_lomnsdl_GeneralKeyword')"
             >
     <xsl:value-of select=
                 "external:loncapa_keywords_to_lomnsdl_GeneralKeyword(.)"/>
           </xsl:when>
           <xsl:otherwise>
    Function external:loncapa_keywords_to_lomnsdl_GeneralKeyword() is not
available!
           </xsl:otherwise>
         </xsl:choose>
</Keyword>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="loncapa:structure">
<Structure>
         <xsl:choose>
           <xsl:when
                 test=
"function-available('external:loncapa_structure_to_lomnsdl_GeneralStructure')"
             >
     <xsl:value-of select=
                  "external:loncapa_structure_to_lomnsdl_GeneralStructure(.)"/>
           </xsl:when>
           <xsl:otherwise>
    Function external:loncapa_structure_to_lomnsdl_GeneralStructure() is not
available!
           </xsl:otherwise>
         </xsl:choose>
</Structure>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="loncapa:aggregation">
<AggregationLevel>
         <xsl:choose>
           <xsl:when
                 test=
"function-available('external:loncapa_aggregation_to_lomnsdl_GeneralAggregationLevel')"
             >
     <xsl:value-of select=
         "external:loncapa_aggregation_to_lomnsdl_GeneralAggregationLevel(.)"/>
           </xsl:when>
           <xsl:otherwise>
Function external:loncapa_aggregation_to_lomnsdl_GeneralAggregationLevel() is
not available!
           </xsl:otherwise>
         </xsl:choose>
</AggregationLevel>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="loncapa:version">
<Version>
         <xsl:choose>
           <xsl:when
                 test=
"function-available('external:loncapa_version_to_lomnsdl_LifeCycleVersion')"
             >
     <xsl:value-of select=
         "external:loncapa_version_to_lomnsdl_LifeCycleVersion(.)"/>
           </xsl:when>
           <xsl:otherwise>
Function external:loncapa_version_to_lomnsdl_LifeCycleVersion() is
not available!
           </xsl:otherwise>
         </xsl:choose>
</Version>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="loncapa:mime">
<Format>
         <xsl:choose>
           <xsl:when
                 test=
"function-available('external:loncapa_mime_to_lomnsdl_TechnicalFormat')"
             >
     <xsl:value-of select=
         "external:loncapa_mime_to_lomnsdl_TechnicalFormat(.)"/>
           </xsl:when>
           <xsl:otherwise>
Function external:loncapa_mime_to_lomnsdl_TechnicalFormat() is not available!
           </xsl:otherwise>
         </xsl:choose>
</Format>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="loncapa:bytesize">
<Size>
         <xsl:choose>
           <xsl:when
                 test=
"function-available('external:loncapa_bytesize_to_lomnsdl_TechnicalSize')"
             >
     <xsl:value-of select=
         "external:loncapa_bytesize_to_lomnsdl_TechnicalSize(.)"/>
           </xsl:when>
           <xsl:otherwise>
Function external:loncapa_bytesize_to_lomnsdl_TechnicalSize() is
not available!
           </xsl:otherwise>
         </xsl:choose>
</Size>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="loncapa:notes">
<Description>
         <xsl:choose>
           <xsl:when
                 test=
"function-available('external:loncapa_notes_to_lomnsdl_EducationalDescription')"
             >
     <xsl:value-of select=
         "external:loncapa_notes_to_lomnsdl_EducationalDescription(.)"/>
           </xsl:when>
           <xsl:otherwise>
Function external:loncapa_notes_to_lomnsdl_EducationalDescription() is
not available!
           </xsl:otherwise>
         </xsl:choose>
</Description>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="loncapa:language">
         <xsl:choose>
           <xsl:when
                 test=
          "function-available('external:loncapa_language_to_converter_INFO')"
             >
             <xsl:value-of select=
                           "external:loncapa_language_to_converter_INFO(.)"/>
           </xsl:when>
           <xsl:otherwise>
     Function external:loncapa_language_to_converter_INFO() is not available!
           </xsl:otherwise>
         </xsl:choose>
</xsl:template>
<xsl:template match="loncapa:author">
         <xsl:choose>
           <xsl:when
                 test=
         "function-available('external:loncapa_author_to_converter_INFO')"
             >
             <xsl:value-of
                    select="external:loncapa_author_to_converter_INFO(.)"/>
           </xsl:when>
           <xsl:otherwise>
         Function external:loncapa_author_to_converter_INFO() is not available!
           </xsl:otherwise>
         </xsl:choose>
</xsl:template>
<xsl:template match="loncapa:lastrevisiondate">
         <xsl:choose>
           <xsl:when
                 test=
    "function-available('external:loncapa_lastrevisiondate_to_converter_INFO')"
             >
             <xsl:value-of
              select="external:loncapa_lastrevisiondate_to_converter_INFO(.)"/>
           </xsl:when>
           <xsl:otherwise>
          Function external:loncapa_lastrevisiondate_to_converter_INFO() is not
available!
           </xsl:otherwise>
         </xsl:choose>
</xsl:template>
<xsl:template match="loncapa:metauri">
         <xsl:choose>
           <xsl:when
                 test=
    "function-available('external:loncapa_metauri_to_converter_INFO')"
             >
             <xsl:value-of
              select="external:loncapa_metauri_to_converter_INFO(.)"/>
           </xsl:when>
           <xsl:otherwise>
          Function external:loncapa_metauri_to_converter_INFO() is not
available!
           </xsl:otherwise>
         </xsl:choose>
</xsl:template>
<xsl:template match="loncapa:copyright">
         <xsl:choose>
           <xsl:when
                 test=
    "function-available('external:loncapa_copyright_to_converter_INFO')"
             >
             <xsl:value-of
              select="external:loncapa_copyright_to_converter_INFO(.)"/>
           </xsl:when>
           <xsl:otherwise>
          Function external:loncapa_copyright_to_converter_INFO() is not
available!
           </xsl:otherwise>
         </xsl:choose>
</xsl:template>
<xsl:template match="loncapa:owner">
         <xsl:choose>
           <xsl:when
                 test=
    "function-available('external:loncapa_owner_to_converter_INFO')"
             >
             <xsl:value-of
              select="external:loncapa_owner_to_converter_INFO(.)"/>
           </xsl:when>
           <xsl:otherwise>
          Function external:loncapa_owner_to_converter_INFO() is not
available!
           </xsl:otherwise>
         </xsl:choose>
</xsl:template>
</xsl:stylesheet>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>