Changeset 13342
- Timestamp:
- 2006-11-27T09:41:43+13:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/etc/dc2marc.xsl
r13224 r13342 8 8 <xsl:param name="mapping" /> 9 9 10 <xsl:variable name="lang" > 11 <xsl:choose> 12 <xsl:when test="/MARCXML/MetadataList/Metadata[@name='dc.Language']"> 13 <xsl:value-of select="/MARCXML/MetadataList/Metadata[@name='dc.Language']"/> 14 </xsl:when> 15 <xsl:when test="/MARCXML/MetadataList/Metadata[@name='Language']"> 16 <xsl:value-of select="/MARCXML/MetadataList/Metadata[@name='Language']"/> 17 </xsl:when> 18 <xsl:otherwise> 19 <xsl:value-of select="en"/> 20 </xsl:otherwise> 21 </xsl:choose> 22 </xsl:variable> 23 <xsl:variable name="item" select="$mapping/stopwords[@lang=$lang]/item"/> 24 25 26 <xsl:template match="/"> 10 <xsl:template match="/"> 27 11 <collection> 28 12 <xsl:apply-templates select="/MARCXML/MetadataList"/> … … 31 15 32 16 <xsl:template match="MetadataList"> 17 <xsl:variable name="lang" > 18 <xsl:choose> 19 <xsl:when test="Metadata[@name='dc.Language']"> 20 <xsl:value-of select="Metadata[@name='dc.Language']"/> 21 </xsl:when> 22 <!-- comment out this if you want to test dls.Language as well 23 <xsl:when test="Metadata[@name='dls.Language']"> 24 <xsl:value-of select="Metadata[@name='dls.Language']"/> 25 </xsl:when> 26 --> 27 <xsl:when test="Metadata[@name='Language']"> 28 <xsl:value-of select="Metadata[@name='Language']"/> 29 </xsl:when> 30 <!-- the defualt language is english --> 31 <xsl:otherwise> 32 <xsl:value-of select="en"/> 33 </xsl:otherwise> 34 </xsl:choose> 35 </xsl:variable> 36 <xsl:variable name="item" select="$mapping/stopwords[@lang=$lang]/item"/> 33 37 <record> 34 38 <xsl:apply-templates select="$mapping/leader"> … … 37 41 <xsl:apply-templates select="$mapping/controlfield[@required='true']" /> 38 42 <xsl:apply-templates select="$mapping/MarcField" > 39 <xsl:with-param name="source" select="." /> 43 <xsl:with-param name="source" select="." /> 44 <xsl:with-param name="item" select="$item" /> 40 45 </xsl:apply-templates> 41 46 </record> … … 107 112 <xsl:template match="MarcField"> 108 113 <xsl:param name="source" /> 114 <xsl:param name="item" /> 109 115 <xsl:variable name="this" select="."/> 110 116 <xsl:choose> … … 114 120 <xsl:apply-templates select="$this/subfield[1]" mode="testing"> 115 121 <xsl:with-param name="pos" select="position()"/> 116 <xsl:with-param name="source" select="$source"/> 122 <xsl:with-param name="source" select="$source"/> 123 <xsl:with-param name="item" select="$item"/> 117 124 </xsl:apply-templates> 118 125 </xsl:for-each> … … 123 130 <xsl:apply-templates select="$this/subfield[1]" mode="testing"> 124 131 <xsl:with-param name="pos" select="position()+1"/> 125 <xsl:with-param name="source" select="$source"/> 132 <xsl:with-param name="source" select="$source"/> 133 <xsl:with-param name="item" select="$item"/> 126 134 </xsl:apply-templates> 127 135 </xsl:for-each> … … 131 139 <xsl:with-param name="pos" select="'0'"/> 132 140 <xsl:with-param name="source" select="$source"/> 141 <xsl:with-param name="item" select="$item"/> 133 142 </xsl:apply-templates> 134 143 </xsl:otherwise> … … 139 148 <xsl:param name="pos"/> 140 149 <xsl:param name="source" /> 150 <xsl:param name="item" /> 141 151 <xsl:variable name="meta" select="@meta"/> 142 152 <xsl:choose> … … 145 155 <xsl:apply-templates select="../@*" mode="mapping-attribute"> 146 156 <xsl:with-param name="source" select="$source"/> 157 <xsl:with-param name="item" select="$item"/> 147 158 </xsl:apply-templates> 148 159 <xsl:apply-templates select="../subfield[not(@nonfiling)]" > … … 153 164 </xsl:when> 154 165 <xsl:otherwise> 155 <xsl:apply-templates select="following-sibling::*[1]" mode="testing" > <xsl:with-param name="source" select="$source"/> 166 <xsl:apply-templates select="following-sibling::*[1]" mode="testing" > 167 <xsl:with-param name="pos" select="$pos"/> 168 <xsl:with-param name="source" select="$source"/> 169 <xsl:with-param name="item" select="$item"/> 156 170 </xsl:apply-templates> 157 171 </xsl:otherwise> … … 161 175 162 176 <xsl:template match="@*" mode="mapping-attribute" > 163 <xsl:param name="source" /> 177 <xsl:param name="source" /> 178 <xsl:param name="item" /> 164 179 <xsl:variable name="name" select="name()"/> 165 180 <xsl:variable name="value" select="."/> … … 192 207 <xsl:param name="subfield" /> 193 208 <xsl:param name="source" /> 209 194 210 <xsl:variable name="itemname" select="@name"/> 195 211 <xsl:variable name="lowercasecontent" select="xsltutil:toLowerCase($content)"/> … … 197 213 <xsl:when test="starts-with($lowercasecontent,$itemname) or count(following-sibling::*)=0"> 198 214 <xsl:choose> 199 <xsl:when test=" count(following-sibling::*) !=0 ">215 <xsl:when test="starts-with($lowercasecontent,$itemname)" > 200 216 <xsl:call-template name="addAttribute" > 201 217 <xsl:with-param name="name" select="$name"/> … … 251 267 <xsl:choose> 252 268 <xsl:when test="@nonfiling='true'"> 253 <subfield code="{@code}"><xsl:value-of select=" substring($content,$length+1)"/><xsl:value-of select="@punc"/></subfield>269 <subfield code="{@code}"><xsl:value-of select="$content"/><xsl:value-of select="@punc"/></subfield> 254 270 </xsl:when> 255 271 <xsl:when test="$pos >0"> … … 268 284 269 285 </xsl:stylesheet> 270
Note:
See TracChangeset
for help on using the changeset viewer.