4 xmlns:html="http://www.w3.org/1999/xhtml"
\r
5 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
\r
6 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
\r
7 xmlns:dc="http://purl.org/dc/elements/1.1/"
\r
10 <xsl:output method="xml" encoding="utf-8" indent="no" omit-xml-declaration="yes" />
\r
12 Ten dokument definiuję przekształcenie odwrotne do wl2html
\r
15 <xsl:template match="comment()"><xsl:copy /></xsl:template>
\r
17 <!-- libxslt has fuck-ed prorities -->
\r
18 <!-- <xsl:template match="@*[not(starts-with(name(), 'x-')) and name() != 'class']">
\r
19 <xsl:message>Boom!: <xsl:value-of select="name()" /></xsl:message>
\r
22 <xsl:template match="@*" priority="0" />
\r
24 <!-- Specjalne reguły dla przypisów -->
\r
25 <xsl:template match="*[@x-annotation-box]|*[@class='theme-text-list']">
\r
26 <xsl:apply-templates select="node()" />
\r
29 <xsl:template match="*[@x-node]">
\r
30 <xsl:element name="{@x-node}" namespace="{@x-ns}">
\r
31 <xsl:apply-templates select="@*" />
\r
32 <xsl:apply-templates select="node()" />
\r
36 <xsl:template match="*[@x-node = 'out-of-flow-text']">
\r
37 <xsl:apply-templates select="child::node()" />
\r
40 <xsl:template match="*[@x-node = 'out-of-flow-text']/text()"><xsl:value-of select="." /></xsl:template>
\r
42 <!-- Specjalne reguły dla wersów -->
\r
43 <xsl:template match="*[@x-node = 'wers']">
\r
44 <xsl:apply-templates select="node()" />
\r
45 <xsl:if test="count(following-sibling::*[starts-with(@x-node, 'wers')]) > 0"><xsl:text>/
</xsl:text></xsl:if>
\r
48 <xsl:template match="*[starts-with(@x-node, 'wers_')]">
\r
49 <xsl:element name="{@x-node}" namespace="{@x-ns}"><xsl:apply-templates select="@*|node()" /></xsl:element>
\r
50 <xsl:if test="count(following-sibling::*[starts-with(@x-node, 'wers')]) > 0"><xsl:text>/
</xsl:text></xsl:if>
\r
53 <xsl:template match="@*[starts-with(name(), 'x-attr-qname-')]">
\r
54 <xsl:variable name="attr-id" select="substring-after(name(), 'x-attr-qname-')" />
\r
55 <xsl:attribute name="{.}" namespace="{parent::*/@*[name() = concat('x-attr-ns-', $attr-id)]}">
\r
56 <xsl:value-of select="parent::*/@*[name() = concat('x-attr-value-', $attr-id)]" />
\r
60 <!-- upper case duplicates for the brain-dead Firefox -->
\r
62 <xsl:template match="@*[starts-with(name(), 'X-ATTR-QNAME-')]">
\r
63 <xsl:variable name="attr-id" select="substring-after(name(), 'X-ATTR-QNAME-')" />
\r
64 <xsl:attribute name="{.}" namespace="{parent::*/@*[name() = concat('X-ATTR-NS-', $attr-id)]}">
\r
65 <xsl:value-of select="parent::*/@*[name() = concat('X-ATTR-VALUE-', $attr-id)]" />
\r
69 <xsl:template match="*[@X-ANNOTATION-BOX]">
\r
70 <xsl:apply-templates select="node()" />
\r
73 <xsl:template match="*[@X-NODE]">
\r
74 <xsl:element name="{@X-NODE}" namespace="{@X-NS}">
\r
75 <xsl:apply-templates select="@*" />
\r
76 <xsl:apply-templates select="node()" />
\r
80 <xsl:template match="*[@X-NODE = 'out-of-flow-text']" priority="1">
\r
81 <xsl:apply-templates select="child::node()" />
\r
84 <xsl:template match="*[@X-NODE = 'out-of-flow-text']/text()"><xsl:value-of select="." /></xsl:template>
\r
86 <!-- Specjalne reguły dla wersów -->
\r
87 <xsl:template match="*[@X-NODE = 'wers']">
\r
88 <xsl:apply-templates select="node()" />
\r
89 <xsl:if test="count(following-sibling::*[starts-with(@X-NODE, 'wers')]) > 0"><xsl:text>/
</xsl:text></xsl:if>
\r
92 <xsl:template match="*[starts-with(@X-NODE, 'wers_')]">
\r
93 <xsl:element name="{@X-NODE}" namespace="{@X-NS}"><xsl:apply-templates select="@*|node()" /></xsl:element>
\r
94 <xsl:if test="count(following-sibling::*[starts-with(@X-NODE, 'wers')]) > 0"><xsl:text>/
</xsl:text></xsl:if>
\r
97 <xsl:template match="*" />
\r