-
Notifications
You must be signed in to change notification settings - Fork 4
/
html-add-class.xsl
71 lines (57 loc) · 2.87 KB
/
html-add-class.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xpath-default-namespace="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="xhtml">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="html/body/@class">
<xsl:attribute name="class">container</xsl:attribute>
</xsl:template>
<xsl:template match="html/body/div/@class[.='stdheader autogenerated']">
<xsl:attribute name="class">stdheader autogenerated text-center</xsl:attribute>
</xsl:template>
<xsl:template match="html/body/div[@class='stdheader autogenerated']/h1[span]">
<xsl:element name="p">
<xsl:attribute name="class">text-grey subtitle</xsl:attribute>
<xsl:apply-templates select="node()|@*"/>
</xsl:element>
</xsl:template>
<xsl:template match="html/body/div[@class='stdfooter autogenerated']">
<xsl:element name="hr"></xsl:element>
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="html/body/div/@class[.='stdfooter autogenerated']">
<xsl:attribute name="class">stdfooter autogenerated row</xsl:attribute>
</xsl:template>
<xsl:template match="html/body/div/div/@class[.='footer']">
<xsl:attribute name="class">footer col-12 text-center</xsl:attribute>
</xsl:template>
<xsl:template match="html//span/@class[.='']">
<xsl:attribute name="class">text-light pull-right</xsl:attribute>
</xsl:template>
<xsl:template match="html//span[@class='']/text()">
<xsl:value-of select="replace(.,'page','pagina')"/>
</xsl:template>
<xsl:template match="html//span[@class='pagebreak']/text()">
<xsl:value-of select="replace(.,'Page','p.')"/>
</xsl:template>
<xsl:template match="html/body/div/address">
<xsl:element name="div">
<xsl:attribute name="class">col text-center text-success</xsl:attribute>
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:element>
</xsl:template>
<xsl:template match="html/body/div/address/text()">
<xsl:text>Croatiae auctores Latini; Universitas Zagrabiensis, Facultas philosophica </xsl:text>
<xsl:apply-templates></xsl:apply-templates>
</xsl:template>
</xsl:stylesheet>