Skip to content
Snippets Groups Projects
Commit 582839bd authored by Goik Martin's avatar Goik Martin
Browse files

extracting duplicate named template

parent c90cb657
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:template name="hdm.get.leftmost.of.seperator">
<xsl:param name="path"/>
<xsl:param name="seperator"/>
<xsl:param name="start">1</xsl:param>
<xsl:if test="contains($path, $seperator )">
<xsl:if test="$start='0'">
<xsl:value-of select="$seperator"/>
</xsl:if>
<xsl:value-of select="substring-before($path, $seperator)"/>
<xsl:call-template name="hdm.get.leftmost.of.seperator">
<xsl:with-param name="path" select="substring-after($path, $seperator)"/>
<xsl:with-param name="seperator" select="$seperator"/>
<xsl:with-param name="start">0</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
......@@ -3,6 +3,8 @@
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://docbook.org/ns/docbook" xmlns:db="http://docbook.org/ns/docbook">
<xsl:include href="common.xsl"/>
<xsl:param name="generateIdPrefix">__sdwordm4342cs__</xsl:param>
<xsl:output indent="yes"/>
<xsl:param name="lastAnswerId" select="document('lastAnswerId.xml',/)/lastAnswer/@id" />
......@@ -146,23 +148,6 @@
</link>
</xsl:template>
<xsl:template name="hdm.get.leftmost.of.seperator">
<xsl:param name="path"/>
<xsl:param name="seperator"/>
<xsl:param name="start">1</xsl:param>
<xsl:if test="contains($path, $seperator )">
<xsl:if test="$start='0'">
<xsl:value-of select="$seperator"/>
</xsl:if>
<xsl:value-of select="substring-before($path, $seperator)"/>
<xsl:call-template name="hdm.get.leftmost.of.seperator">
<xsl:with-param name="path" select="substring-after($path, $seperator)"/>
<xsl:with-param name="seperator" select="$seperator"/>
<xsl:with-param name="start">0</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Excluding non-referenced <bibliography> and <glossary> elements -->
<xsl:template match="db:bibliography/db:biblioentry[not(key('internRef', @xml:id))]">
......@@ -175,6 +160,24 @@
</xsl:comment>
</xsl:template>
<xsl:template match="db:glossary//db:glosslist">
<xsl:choose>
<xsl:when test=".//db:glossentry[key('internRef', @xml:id) or key('internRef', .//*/@xml:id)]">
<xsl:comment>Non-empty glosslist</xsl:comment>
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:when>
<xsl:otherwise>
<xsl:comment>
<xsl:text>No @xml:id or all glosslist entries are not being referenced, excluding whole list.</xsl:text>
</xsl:comment>
<xsl:apply-templates select="db:glossentry"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="db:glossary/db:glosslist//db:glossentry[not(key('internRef', @xml:id)) and not(key('internRef', .//*/@xml:id))]">
<xsl:comment>
<xsl:text>Excluding non referenced glossary entry '</xsl:text>
......
......@@ -3,7 +3,7 @@
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://docbook.org/ns/docbook" xmlns:d="http://docbook.org/ns/docbook">
<xsl:include href="common.xsl"/>
<xsl:template match="/">
<xsl:apply-templates select="//d:imagedata[ends-with(@fileref, '.fig') ]" mode="goik"/>
......@@ -64,25 +64,7 @@
</xsl:text>
</xsl:result-document>
</xsl:template>
<xsl:template name="hdm.get.leftmost.of.seperator">
<xsl:param name="path"/>
<xsl:param name="seperator"/>
<xsl:param name="start">1</xsl:param>
<xsl:if test="contains($path, $seperator )">
<xsl:if test="$start='0'">
<xsl:value-of select="$seperator"/>
</xsl:if>
<xsl:value-of select="substring-before($path, $seperator)"/>
<xsl:call-template name="hdm.get.leftmost.of.seperator">
<xsl:with-param name="path" select="substring-after($path, $seperator)"/>
<xsl:with-param name="seperator" select="$seperator"/>
<xsl:with-param name="start">0</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="hdm.get.pure.filename">
<xsl:param name="path"/>
<xsl:choose>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment