Project

Profile

Help

Bug #1613 » view_names.xsl

Manfred Staudinger, 2012-08-27 07:40

 
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:dr="http://documenta.rudolphina.org/"
exclude-result-prefixes="dr html"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
java -jar D:\Programme\Saxon6\saxon.jar Namen/Aachen_Hans_von.xml view_names.xsl
-->
<xsl:output method="html" indent="no" />
<xsl:variable name="vers" select="dr:doc/@v"/>

<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="dr:*"/>
<xsl:template match="html:ul | html:ol">
<xsl:copy>
<xsl:call-template name="insert-list">
<xsl:with-param name="list" select="."/>
</xsl:call-template>
</xsl:copy>
</xsl:template>
<xsl:template match="html:div[@class='docindex']/html:b">
<xsl:text> </xsl:text>
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
<xsl:text> </xsl:text>
</xsl:template>
<xsl:template match="html:a[parent::html:div[@class='docindex']][contains(@href,'/Regesten')]">
<a class="Z{substring(substring-after(substring-after(@href,'/Regesten'), '/'),13,5)}">
<xsl:apply-templates select="@*"/>
<xsl:value-of select="."/>
</a>
<span class="Z{substring(substring-after(substring-after(@href,'/Regesten'), '/'),13,5)}"><xsl:value-of select="."/></span>
<xsl:text> </xsl:text>
</xsl:template>
<xsl:template match="dr:doc">
<body>
<div id="htmlbody">
<h3><a href="../Index.html" title="Home">Documenta Rudolphina</a></h3>
<div id="xmlbody">
<xsl:apply-templates select="node()[not(preceding::html:div[@class='docindex'])][preceding::html:title]"/>
</div>
<xsl:if test="normalize-space(node()[preceding::html:div[@class='docindex']])">
<div id="zusatz">
<xsl:apply-templates select="node()[preceding::html:div[@class='docindex']]"/>
</div>
</xsl:if>
<div class="last">
<div class="floatright"><span><xsl:value-of select="concat('Copyright © ', substring($vers, 1, 4), ' Manfred Staudinger')"/></span></div>
<div class="verslink">
<a href="" onclick="toggleId(&apos;Zit{generate-id(.)}&apos;);return false;" title="Zitiervorschlag">
<xsl:value-of select="concat('Version: ', $vers)"/>
</a>
</div>
<div id="Zit{generate-id(.)}" style="display: none">
<span>
<xsl:value-of select="concat('Staudinger Manfred (Bearb.),',
' Documenta Rudolphina,',
' http://documenta.rudolphina.org/Namen/', /dr:doc/@uri, '.xml',
' [Version: ', $vers, ']')"/>
</span>
</div>
</div>
</div>
</body>
</xsl:template>
<!-- white-space handling in IE:
output indent="no" eleminiert allen white-space in IE.
Nach jedem span, sowie vor und nach dem b wird ein blank
eingefügt. Zwischen a und span gibt es somit keinen white-space
-->
<!-- Fehler im IE: br wird verdoppelt! -->
<xsl:template match="html:br">
<xsl:copy/>
</xsl:template>

<xsl:template match="/">
<html lang="de">
<head>
<xsl:choose>
<xsl:when test="system-property('xsl:vendor')='Microsoft'">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</xsl:when>
<xsl:otherwise>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
</xsl:otherwise>
</xsl:choose>
<title><xsl:value-of select="dr:doc/html:title"/></title>
<link rel="stylesheet" href="../css/Namen_b.css" type="text/css"/>
<link rel="icon" href="../favicon.ico" type="image/x-icon"/>
<script type="text/javascript" language="javascript" src="../../SaxonceDebug/Saxonce.nocache.js"/>
<script>
var onSaxonLoad = function() {
Saxon.run( {
source: location.href,
logLevel: "FINEST",
stylesheet: "namen.xsl"
});
}
</script>
</head>
<xsl:apply-templates select="dr:doc"/>
</html>
</xsl:template>

<xsl:template name="insert-list">
<xsl:param name="list"/>
<xsl:param name="line" select="''"/>
<xsl:choose>
<xsl:when test="$line">
<li><xsl:value-of select="$line"/></li>
<xsl:call-template name="insert-list">
<xsl:with-param name="list" select="$list"/>
<xsl:with-param name="line" select="''"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($list,'&#10;')">
<xsl:call-template name="insert-list">
<xsl:with-param name="list" select="substring-after($list, '&#10;')"/>
<xsl:with-param name="line" select="normalize-space(substring-before($list, '&#10;'))"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="not($list)"/>
<xsl:otherwise>
<xsl:call-template name="insert-list">
<xsl:with-param name="list" select="''"/>
<xsl:with-param name="line" select="normalize-space($list)"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

</xsl:stylesheet>
(3-3/4)