+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
+ Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+
+-->
<xsl:stylesheet
version="1.0"
-
+
xmlns="http://www.w3.org/1999/xhtml"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:wl="http://wolnelektury.pl/functions"
exclude-result-prefixes="wl" >
indent="yes"
omit-xml-declaration = "yes" />
- <!--
+ <!--
Dokument ten opisuje podstawowe przekształcenia potrzebne
do zamiany dokumentu WLML 1.0 na poprawnie sformatowany
dokument XHMTL.
<xsl:param name="element" />
<xsl:param name="mypath" />
<xsl:param name="mixed" />
-
+
<xsl:for-each select="child::node()">
<xsl:apply-templates select="." mode="element-tag">
<xsl:with-param name="offset" select="count(preceding-sibling::*)" />
</xsl:apply-templates>
</xsl:for-each>
</xsl:template>
-
+
<xsl:template name="generic-content">
<xsl:param name="element" />
<xsl:param name="mypath" />
<xsl:with-param name="mixed" select="$mixed" />
</xsl:call-template>
</xsl:template>
-
+
<!-- Generyczne szablony -->
<xsl:template name="generic" >
<xsl:param name="element" />
<xsl:variable name="tag" select="name($element)" />
<xsl:variable name="group" select="$config//types/*[@element and child::*[local-name() = $tag]]" />
-
+
<xsl:choose>
<!-- ignore namespaced elements -->
<xsl:when test="namespace-uri()" />
<xsl:when test="$group/@element">
-
+
<xsl:element name="{$group/@element}" namespace="http://www.w3.org/1999/xhtml">
<xsl:apply-templates select="$element" mode="element-content" >
<xsl:with-param name="mypath" select="$mypath" />
<xsl:template match="pr|pa|pe|pt" mode="element-tag">
<a href="#annotation-{generate-id(.)}"><span class="annotation"/></a><a name="anchor-{generate-id(.)}" />
- </xsl:template>
+ </xsl:template>
<xsl:template match="dlugi_cytat|poezja_cyt" mode="element-tag">
<xsl:param name="offset" />
<xsl:variable name="mypath"
select="concat($parent-path, '/', name(), '[',string($offset),']')" />
-
+
<xsl:call-template name="generic-descent">
<xsl:with-param name="element" select="current()" />
<xsl:with-param name="mypath" select="$mypath" />
<xsl:with-param name="mixed" select="$mixed"/>
</xsl:call-template>
</xsl:template>
-
+
<xsl:template match="text()" mode="element-tag">
<xsl:param name="mixed" />
<xsl:choose>
-
+
<xsl:when test="not($mixed)">
<xsl:choose>
<xsl:when test="not(normalize-space(.))" />
</xsl:otherwise>
</xsl:choose>
</xsl:when>
-
+
<xsl:otherwise>
<xsl:value-of select="wl:substitute_entities(.)">
<xsl:fallback>
</xsl:otherwise>
</xsl:choose>
-
+
</xsl:template>
<xsl:template match="node()" />
-
+
</xsl:stylesheet>