|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
$Id
|
|
Packit Service |
76cb02 |
********************************************************************
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
This file is part of the XSL DocBook Stylesheet distribution.
|
|
Packit Service |
76cb02 |
See ../README or http://docbook.sf.net/release/xsl/current/ for
|
|
Packit Service |
76cb02 |
copyright and other information.
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
This module implements DTD-independent functions
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
******************************************************************** -->
|
|
Packit Service |
76cb02 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template name="dot.count">
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:param name="string"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="count" select="0"/>
|
|
Packit Service |
76cb02 |
<xsl:choose>
|
|
Packit Service |
76cb02 |
<xsl:when test="contains($string, '.')">
|
|
Packit Service |
76cb02 |
<xsl:call-template name="dot.count">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="string" select="substring-after($string, '.')"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="count" select="$count+1"/>
|
|
Packit Service |
76cb02 |
</xsl:call-template>
|
|
Packit Service |
76cb02 |
</xsl:when>
|
|
Packit Service |
76cb02 |
<xsl:otherwise>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$count"/>
|
|
Packit Service |
76cb02 |
</xsl:otherwise>
|
|
Packit Service |
76cb02 |
</xsl:choose>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template name="pi-attribute">
|
|
Packit Service |
76cb02 |
<xsl:param name="pis" select="processing-instruction('BOGUS_PI')"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="attribute">filename</xsl:param>
|
|
Packit Service |
76cb02 |
<xsl:param name="count">1</xsl:param>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:choose>
|
|
Packit Service |
76cb02 |
<xsl:when test="$count>count($pis)">
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
</xsl:when>
|
|
Packit Service |
76cb02 |
<xsl:otherwise>
|
|
Packit Service |
76cb02 |
<xsl:variable name="pi">
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$pis[$count]"/>
|
|
Packit Service |
76cb02 |
</xsl:variable>
|
|
Packit Service |
76cb02 |
<xsl:variable name="pivalue">
|
|
Packit Service |
76cb02 |
<xsl:value-of select="concat(' ', normalize-space($pi))"/>
|
|
Packit Service |
76cb02 |
</xsl:variable>
|
|
Packit Service |
76cb02 |
<xsl:choose>
|
|
Packit Service |
76cb02 |
<xsl:when test="contains($pivalue,concat(' ', $attribute, '='))">
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
select="substring-after($pivalue,concat(' ', $attribute,'='))"/>
|
|
Packit Service |
76cb02 |
<xsl:variable name="quote" select="substring($rest,1,1)"/>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="substring-before(substring($rest,2),$quote)"/>
|
|
Packit Service |
76cb02 |
</xsl:when>
|
|
Packit Service |
76cb02 |
<xsl:otherwise>
|
|
Packit Service |
76cb02 |
<xsl:call-template name="pi-attribute">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="pis" select="$pis"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="attribute" select="$attribute"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="count" select="$count + 1"/>
|
|
Packit Service |
76cb02 |
</xsl:call-template>
|
|
Packit Service |
76cb02 |
</xsl:otherwise>
|
|
Packit Service |
76cb02 |
</xsl:choose>
|
|
Packit Service |
76cb02 |
</xsl:otherwise>
|
|
Packit Service |
76cb02 |
</xsl:choose>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template name="xpath.location">
|
|
Packit Service |
76cb02 |
<xsl:param name="node" select="."/>
|
|
Packit Service |
76cb02 |
<xsl:param name="path" select="''"/>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:variable name="next.path">
|
|
Packit Service |
76cb02 |
<xsl:value-of select="local-name($node)"/>
|
|
Packit Service |
76cb02 |
<xsl:if test="$path != ''">/</xsl:if>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$path"/>
|
|
Packit Service |
76cb02 |
</xsl:variable>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:choose>
|
|
Packit Service |
76cb02 |
<xsl:when test="$node/parent::*">
|
|
Packit Service |
76cb02 |
<xsl:call-template name="xpath.location">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="node" select="$node/parent::*"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="path" select="$next.path"/>
|
|
Packit Service |
76cb02 |
</xsl:call-template>
|
|
Packit Service |
76cb02 |
</xsl:when>
|
|
Packit Service |
76cb02 |
<xsl:otherwise>
|
|
Packit Service |
76cb02 |
<xsl:text>/</xsl:text>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$next.path"/>
|
|
Packit Service |
76cb02 |
</xsl:otherwise>
|
|
Packit Service |
76cb02 |
</xsl:choose>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template name="count.uri.path.depth">
|
|
Packit Service |
76cb02 |
<xsl:param name="filename" select="''"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="count" select="0"/>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:choose>
|
|
Packit Service |
76cb02 |
<xsl:when test="contains($filename, '/')">
|
|
Packit Service |
76cb02 |
<xsl:call-template name="count.uri.path.depth">
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
select="substring-after($filename, '/')"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="count" select="$count + 1"/>
|
|
Packit Service |
76cb02 |
</xsl:call-template>
|
|
Packit Service |
76cb02 |
</xsl:when>
|
|
Packit Service |
76cb02 |
<xsl:otherwise>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$count"/>
|
|
Packit Service |
76cb02 |
</xsl:otherwise>
|
|
Packit Service |
76cb02 |
</xsl:choose>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template name="trim.common.uri.paths">
|
|
Packit Service |
76cb02 |
<xsl:param name="uriA" select="''"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="uriB" select="''"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="return" select="'A'"/>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:choose>
|
|
Packit Service |
76cb02 |
<xsl:when test="contains($uriA, '/') and contains($uriB, '/') and substring-before($uriA, '/') = substring-before($uriB, '/')">
|
|
Packit Service |
76cb02 |
<xsl:call-template name="trim.common.uri.paths">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="uriA" select="substring-after($uriA, '/')"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="uriB" select="substring-after($uriB, '/')"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="return" select="$return"/>
|
|
Packit Service |
76cb02 |
</xsl:call-template>
|
|
Packit Service |
76cb02 |
</xsl:when>
|
|
Packit Service |
76cb02 |
<xsl:otherwise>
|
|
Packit Service |
76cb02 |
<xsl:choose>
|
|
Packit Service |
76cb02 |
<xsl:when test="$return = 'A'">
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$uriA"/>
|
|
Packit Service |
76cb02 |
</xsl:when>
|
|
Packit Service |
76cb02 |
<xsl:otherwise>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$uriB"/>
|
|
Packit Service |
76cb02 |
</xsl:otherwise>
|
|
Packit Service |
76cb02 |
</xsl:choose>
|
|
Packit Service |
76cb02 |
</xsl:otherwise>
|
|
Packit Service |
76cb02 |
</xsl:choose>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:template name="copy-string">
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:param name="string"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="count" select="0"/>
|
|
Packit Service |
76cb02 |
<xsl:param name="result"/>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
<xsl:choose>
|
|
Packit Service |
76cb02 |
<xsl:when test="$count>0">
|
|
Packit Service |
76cb02 |
<xsl:call-template name="copy-string">
|
|
Packit Service |
76cb02 |
<xsl:with-param name="string" select="$string"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="count" select="$count - 1"/>
|
|
Packit Service |
76cb02 |
<xsl:with-param name="result">
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$result"/>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$string"/>
|
|
Packit Service |
76cb02 |
</xsl:with-param>
|
|
Packit Service |
76cb02 |
</xsl:call-template>
|
|
Packit Service |
76cb02 |
</xsl:when>
|
|
Packit Service |
76cb02 |
<xsl:otherwise>
|
|
Packit Service |
76cb02 |
<xsl:value-of select="$result"/>
|
|
Packit Service |
76cb02 |
</xsl:otherwise>
|
|
Packit Service |
76cb02 |
</xsl:choose>
|
|
Packit Service |
76cb02 |
</xsl:template>
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
</xsl:stylesheet>
|