| 1 | <?xml version="1.0" encoding="UTF-8"?> |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
|---|
| 5 | xmlns="http://www.imsglobal.org/xsd/imscp_v1p1" |
|---|
| 6 | xmlns:imscp="http://www.imsglobal.org/xsd/imscp_v1p1" |
|---|
| 7 | xmlns:imsmd="http://www.imsglobal.org/xsd/imsmd_v1p2" |
|---|
| 8 | xmlns:lom="http://ocw.mit.edu/xmlns/LOM" |
|---|
| 9 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|---|
| 10 | xmlns:eduCommons="http://cosl.usu.edu/xsd/eduCommonsv1.2" |
|---|
| 11 | xmlns:cwsp="http://www.dspace.org/xmlns/cwspace_imscp" |
|---|
| 12 | xmlns:adlcp="http://www.adlnet.org/xsd/adlcp_rootv1p2" |
|---|
| 13 | xmlns:ocw="http://ocw.mit.edu/xmlns/ocw_imscp" |
|---|
| 14 | version="1.0"> |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | <xsl:output method="xml" indent="yes" /> |
|---|
| 19 | |
|---|
| 20 | <xsl:template match="/"> |
|---|
| 21 | <manifest xsi:schemaLocation="http://www.imsglobal.org/xsd/imscp_v1p1 imscp_v1p2.xsd http://www.imsglobal.org/xsd/imsmd_v1p2 imsmd_v1p2p4.xsd http://cosl.usu.edu/xsd/eduCommonsv1.2 eduCommonsv1.2.xsd"> |
|---|
| 22 | <xsl:attribute name="identifier"> |
|---|
| 23 | <xsl:value-of select="manifest/@identifier"/> |
|---|
| 24 | </xsl:attribute> |
|---|
| 25 | <xsl:apply-templates/> |
|---|
| 26 | </manifest> |
|---|
| 27 | </xsl:template> |
|---|
| 28 | |
|---|
| 29 | <xsl:template match="manifest/organizations"> |
|---|
| 30 | <organizations> |
|---|
| 31 | <xsl:attribute name="default"> |
|---|
| 32 | <xsl:value-of select="@default"/> |
|---|
| 33 | </xsl:attribute> |
|---|
| 34 | <xsl:apply-templates/> |
|---|
| 35 | </organizations> |
|---|
| 36 | </xsl:template> |
|---|
| 37 | |
|---|
| 38 | <xsl:template match="organization"> |
|---|
| 39 | <organization> |
|---|
| 40 | <xsl:attribute name="identifier"> |
|---|
| 41 | <xsl:value-of select = "@identifier" /> |
|---|
| 42 | </xsl:attribute> |
|---|
| 43 | <xsl:apply-templates/> |
|---|
| 44 | </organization> |
|---|
| 45 | </xsl:template> |
|---|
| 46 | |
|---|
| 47 | <xsl:template match="title"> |
|---|
| 48 | <title> |
|---|
| 49 | <xsl:value-of select="."/> |
|---|
| 50 | </title> |
|---|
| 51 | </xsl:template> |
|---|
| 52 | |
|---|
| 53 | <xsl:template match="item"> |
|---|
| 54 | <item> |
|---|
| 55 | <xsl:variable name="identifierref" select="@identifierref"/> |
|---|
| 56 | <xsl:variable name="resource" select="/manifest/resources//resource[@identifier=$identifierref]/@href"/> |
|---|
| 57 | <xsl:variable name="ext" select="substring-after($resource,'.')"/> |
|---|
| 58 | |
|---|
| 59 | <xsl:attribute name="identifier"> |
|---|
| 60 | <xsl:value-of select = "@identifier" /> |
|---|
| 61 | </xsl:attribute> |
|---|
| 62 | <xsl:attribute name="identifierref"> |
|---|
| 63 | <xsl:value-of select = "$identifierref" /> |
|---|
| 64 | <xsl:value-of select="concat('.',$ext)"/> |
|---|
| 65 | </xsl:attribute> |
|---|
| 66 | <xsl:attribute name="isvisible"> |
|---|
| 67 | <xsl:text>true</xsl:text> |
|---|
| 68 | </xsl:attribute> |
|---|
| 69 | <xsl:apply-templates/> |
|---|
| 70 | </item> |
|---|
| 71 | </xsl:template> |
|---|
| 72 | |
|---|
| 73 | <xsl:template match="resources"> |
|---|
| 74 | <resources> |
|---|
| 75 | <xsl:apply-templates /> |
|---|
| 76 | </resources> |
|---|
| 77 | </xsl:template> |
|---|
| 78 | |
|---|
| 79 | <xsl:template match="resource"> |
|---|
| 80 | <resource> |
|---|
| 81 | |
|---|
| 82 | |
|---|
| 83 | <xsl:variable name="identifier" select="@identifier"/> |
|---|
| 84 | <xsl:variable name="title" select="/manifest/organizations//item[@identifierref=$identifier]/title"/> |
|---|
| 85 | |
|---|
| 86 | <xsl:attribute name="identifier"> |
|---|
| 87 | <xsl:value-of select="concat(@identifier,'.',substring-after(@href,'.'))"/> |
|---|
| 88 | </xsl:attribute> |
|---|
| 89 | <xsl:attribute name="href"> |
|---|
| 90 | <xsl:value-of select="@href"/> |
|---|
| 91 | </xsl:attribute> |
|---|
| 92 | <xsl:attribute name="type"> |
|---|
| 93 | <xsl:value-of select="@type"/> |
|---|
| 94 | </xsl:attribute> |
|---|
| 95 | |
|---|
| 96 | <metadata> |
|---|
| 97 | <imsmd:lom> |
|---|
| 98 | <imsmd:general> |
|---|
| 99 | <imsmd:title> |
|---|
| 100 | <imsmd:langstring xml:lang="en"> |
|---|
| 101 | <xsl:value-of select="$title"/> |
|---|
| 102 | </imsmd:langstring> |
|---|
| 103 | </imsmd:title> |
|---|
| 104 | </imsmd:general> |
|---|
| 105 | <imsmd:technical> |
|---|
| 106 | |
|---|
| 107 | </imsmd:technical> |
|---|
| 108 | </imsmd:lom> |
|---|
| 109 | <eduCommons:eduCommons> |
|---|
| 110 | <xsl:if test="$title='Welcome'"> |
|---|
| 111 | <eduCommons:objectType> |
|---|
| 112 | Course |
|---|
| 113 | </eduCommons:objectType> |
|---|
| 114 | </xsl:if> |
|---|
| 115 | <eduCommons:license category="Site Default"/> |
|---|
| 116 | <eduCommons:clearedCopyright>true</eduCommons:clearedCopyright> |
|---|
| 117 | </eduCommons:eduCommons> |
|---|
| 118 | </metadata> |
|---|
| 119 | |
|---|
| 120 | |
|---|
| 121 | |
|---|
| 122 | <xsl:apply-templates select="file" /> |
|---|
| 123 | </resource> |
|---|
| 124 | </xsl:template> |
|---|
| 125 | |
|---|
| 126 | |
|---|
| 127 | <xsl:template match="file"> |
|---|
| 128 | <file> |
|---|
| 129 | <xsl:attribute name="href"> |
|---|
| 130 | <xsl:value-of select="translate(@href,'\','/')"/> |
|---|
| 131 | </xsl:attribute> |
|---|
| 132 | </file> |
|---|
| 133 | </xsl:template> |
|---|
| 134 | |
|---|
| 135 | |
|---|
| 136 | |
|---|
| 137 | </xsl:stylesheet> |
|---|