Bug 6803: Replacing remote XSL include
Replacing remote include by local one.
This resolves possible connectivity issues (see Bugzilla comments).
Should theoretically be safer and faster too.
December 7, 2011: Rebased and included nbsp entity definition (bug 7141).
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
(cherry picked from commit 5db3397041)
Signed-off-by: Chris Nighswonger <chris.nighswonger@gmail.com>
This commit is contained in:
parent
3276a31778
commit
49a87a3df5
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsl:stylesheet version="1.0" xmlns="http://www.loc.gov/mods/v3" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xlink marc">
|
||||
<xsl:include href="http://www.loc.gov/marcxml/xslt/MARC21slimUtils.xsl"/>
|
||||
<xsl:include href="MARC21slimUtils-MODS31.xsl"/>
|
||||
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
|
||||
<!--
|
||||
|
||||
|
|
@ -2518,4 +2518,4 @@ Added Log Comment
|
|||
<metaInformation>
|
||||
<scenarios/><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>
|
||||
</metaInformation>
|
||||
-->
|
||||
-->
|
||||
|
|
|
|||
|
|
@ -0,0 +1,190 @@
|
|||
<?xml version='1.0'?>
|
||||
<!DOCTYPE stylesheet [<!ENTITY nbsp " " >]>
|
||||
<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<!-- 08/08/08: tmee added corrected chopPunctuation templates for 260c -->
|
||||
<!-- 08/19/04: ntra added "marc:" prefix to datafield element -->
|
||||
<!-- 12/14/07: ntra added url encoding template -->
|
||||
<!-- url encoding -->
|
||||
|
||||
<xsl:variable name="ascii">
|
||||
<xsl:text> !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~</xsl:text>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="latin1">
|
||||
<xsl:text> ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ</xsl:text>
|
||||
</xsl:variable>
|
||||
<!-- Characters that usually don't need to be escaped -->
|
||||
<xsl:variable name="safe">
|
||||
<xsl:text>!'()*-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~</xsl:text>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="hex">0123456789ABCDEF</xsl:variable>
|
||||
|
||||
|
||||
<xsl:template name="datafield">
|
||||
<xsl:param name="tag"/>
|
||||
<xsl:param name="ind1">
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:param>
|
||||
<xsl:param name="ind2">
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:param>
|
||||
<xsl:param name="subfields"/>
|
||||
<xsl:element name="marc:datafield">
|
||||
<xsl:attribute name="tag">
|
||||
<xsl:value-of select="$tag"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="ind1">
|
||||
<xsl:value-of select="$ind1"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="ind2">
|
||||
<xsl:value-of select="$ind2"/>
|
||||
</xsl:attribute>
|
||||
<xsl:copy-of select="$subfields"/>
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="subfieldSelect">
|
||||
<xsl:param name="codes">abcdefghijklmnopqrstuvwxyz</xsl:param>
|
||||
<xsl:param name="delimeter">
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:param>
|
||||
<xsl:variable name="str">
|
||||
<xsl:for-each select="marc:subfield">
|
||||
<xsl:if test="contains($codes, @code)">
|
||||
<xsl:value-of select="text()"/>
|
||||
<xsl:value-of select="$delimeter"/>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:variable>
|
||||
<xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="buildSpaces">
|
||||
<xsl:param name="spaces"/>
|
||||
<xsl:param name="char">
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:param>
|
||||
<xsl:if test="$spaces>0">
|
||||
<xsl:value-of select="$char"/>
|
||||
<xsl:call-template name="buildSpaces">
|
||||
<xsl:with-param name="spaces" select="$spaces - 1"/>
|
||||
<xsl:with-param name="char" select="$char"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="chopPunctuation">
|
||||
<xsl:param name="chopString"/>
|
||||
<xsl:param name="punctuation">
|
||||
<xsl:text>.:,;/ </xsl:text>
|
||||
</xsl:param>
|
||||
<xsl:variable name="length" select="string-length($chopString)"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$length=0"/>
|
||||
<xsl:when test="contains($punctuation, substring($chopString,$length,1))">
|
||||
<xsl:call-template name="chopPunctuation">
|
||||
<xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>
|
||||
<xsl:with-param name="punctuation" select="$punctuation"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="not($chopString)"/>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$chopString"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="chopPunctuationFront">
|
||||
<xsl:param name="chopString"/>
|
||||
<xsl:variable name="length" select="string-length($chopString)"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$length=0"/>
|
||||
<xsl:when test="contains('.:,;/[ ', substring($chopString,1,1))">
|
||||
<xsl:call-template name="chopPunctuationFront">
|
||||
<xsl:with-param name="chopString" select="substring($chopString,2,$length - 1)"
|
||||
/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="not($chopString)"/>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$chopString"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="chopPunctuationBack">
|
||||
<xsl:param name="chopString"/>
|
||||
<xsl:param name="punctuation">
|
||||
<xsl:text>.:,;/] </xsl:text>
|
||||
</xsl:param>
|
||||
<xsl:variable name="length" select="string-length($chopString)"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$length=0"/>
|
||||
<xsl:when test="contains($punctuation, substring($chopString,$length,1))">
|
||||
<xsl:call-template name="chopPunctuation">
|
||||
<xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>
|
||||
<xsl:with-param name="punctuation" select="$punctuation"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="not($chopString)"/>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$chopString"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- nate added 12/14/2007 for lccn.loc.gov: url encode ampersand, etc. -->
|
||||
<xsl:template name="url-encode">
|
||||
|
||||
<xsl:param name="str"/>
|
||||
|
||||
<xsl:if test="$str">
|
||||
<xsl:variable name="first-char" select="substring($str,1,1)"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($safe,$first-char)">
|
||||
<xsl:value-of select="$first-char"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:variable name="codepoint">
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($ascii,$first-char)">
|
||||
<xsl:value-of
|
||||
select="string-length(substring-before($ascii,$first-char)) + 32"
|
||||
/>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($latin1,$first-char)">
|
||||
<xsl:value-of
|
||||
select="string-length(substring-before($latin1,$first-char)) + 160"/>
|
||||
<!-- was 160 -->
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:message terminate="no">Warning: string contains a character
|
||||
that is out of range! Substituting "?".</xsl:message>
|
||||
<xsl:text>63</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="hex-digit1"
|
||||
select="substring($hex,floor($codepoint div 16) + 1,1)"/>
|
||||
<xsl:variable name="hex-digit2" select="substring($hex,$codepoint mod 16 + 1,1)"/>
|
||||
<!-- <xsl:value-of select="concat('%',$hex-digit2)"/> -->
|
||||
<xsl:value-of select="concat('%',$hex-digit1,$hex-digit2)"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="string-length($str) > 1">
|
||||
<xsl:call-template name="url-encode">
|
||||
<xsl:with-param name="str" select="substring($str,2)"/>
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
|
||||
<metaInformation>
|
||||
<scenarios/><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>
|
||||
</metaInformation>
|
||||
-->
|
||||
|
||||
Loading…
Reference in New Issue