summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <bfr@qbus.de>2015-02-19 08:47:10 +0100
committerBenjamin Franzke <bfr@qbus.de>2015-02-19 09:26:19 +0100
commitb57490031b95c017c58bd17d1c9ebcf7ac73807f (patch)
treee1c2d9af1502203fd3d49e5d2622dd94f6572111
parent4052f8a1c7d64b33b38219fe823020dcdfb5f157 (diff)
downloadendnote-import-b57490031b95c017c58bd17d1c9ebcf7ac73807f.tar.gz
endnote-import-b57490031b95c017c58bd17d1c9ebcf7ac73807f.tar.bz2
endnote-import-b57490031b95c017c58bd17d1c9ebcf7ac73807f.zip
Move string-replace-all to util.xsl
-rw-r--r--convert-style-to-html.xsl25
-rw-r--r--endnote-to-dbxml.xsl24
-rw-r--r--util.xsl23
3 files changed, 25 insertions, 47 deletions
diff --git a/convert-style-to-html.xsl b/convert-style-to-html.xsl
index 9858964..dbc7281 100644
--- a/convert-style-to-html.xsl
+++ b/convert-style-to-html.xsl
@@ -3,6 +3,8 @@
<xsl:output method="xml" indent="yes" encoding="UTF-8" />
+ <xsl:include href="util.xsl"/>
+
<!-- Convert endnote style definitions declarations to html tags -->
<!-- TODO: <author>Editors,</author> bzw <author>Editor,</author> -->
<xsl:template match="style" name="style">
@@ -77,29 +79,6 @@
</xsl:copy>
</xsl:template>
- <xsl:template name="string-replace-all">
- <xsl:param name="text" />
- <xsl:param name="replace" />
- <xsl:param name="by" />
- <xsl:choose>
- <xsl:when test="$replace = ''">
- <xsl:value-of select="$text" />
- </xsl:when>
- <xsl:when test="contains($text, $replace)">
- <xsl:value-of select="substring-before($text,$replace)" />
- <xsl:value-of select="$by" />
- <xsl:call-template name="string-replace-all">
- <xsl:with-param name="text" select="substring-after($text,$replace)" />
- <xsl:with-param name="replace" select="$replace" />
- <xsl:with-param name="by" select="$by" />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$text" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
diff --git a/endnote-to-dbxml.xsl b/endnote-to-dbxml.xsl
index f8880db..1783f0a 100644
--- a/endnote-to-dbxml.xsl
+++ b/endnote-to-dbxml.xsl
@@ -91,28 +91,4 @@
</db>
</xsl:template>
-
- <xsl:template name="string-replace-all">
- <xsl:param name="text" />
- <xsl:param name="replace" />
- <xsl:param name="by" />
- <xsl:choose>
- <xsl:when test="$replace = ''">
- <xsl:value-of select="$text" />
- </xsl:when>
- <xsl:when test="contains($text, $replace)">
- <xsl:value-of select="substring-before($text,$replace)" />
- <xsl:value-of select="$by" />
- <xsl:call-template name="string-replace-all">
- <xsl:with-param name="text" select="substring-after($text,$replace)" />
- <xsl:with-param name="replace" select="$replace" />
- <xsl:with-param name="by" select="$by" />
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$text" />
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
</xsl:stylesheet>
diff --git a/util.xsl b/util.xsl
index 19e6cf9..1c8bb5a 100644
--- a/util.xsl
+++ b/util.xsl
@@ -51,4 +51,27 @@
<xsl:template mode="nodetype" match="@*">attribute</xsl:template>
<xsl:template mode="nodetype" match="text()">text</xsl:template>
+ <xsl:template name="string-replace-all">
+ <xsl:param name="text" />
+ <xsl:param name="replace" />
+ <xsl:param name="by" />
+ <xsl:choose>
+ <xsl:when test="$replace = ''">
+ <xsl:value-of select="$text" />
+ </xsl:when>
+ <xsl:when test="contains($text, $replace)">
+ <xsl:value-of select="substring-before($text,$replace)" />
+ <xsl:value-of select="$by" />
+ <xsl:call-template name="string-replace-all">
+ <xsl:with-param name="text" select="substring-after($text,$replace)" />
+ <xsl:with-param name="replace" select="$replace" />
+ <xsl:with-param name="by" select="$by" />
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$text" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
</xsl:stylesheet>