-
Notifications
You must be signed in to change notification settings - Fork 0
/
boxed-text-workaround.xsl
46 lines (42 loc) · 1.74 KB
/
boxed-text-workaround.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
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xlink="http://www.w3.org/1999/xlink"
exclude-result-prefixes="xs"
version="3.0">
<xsl:output method="xml" encoding="UTF-8"/>
<xsl:template match="*|@*|text()|comment()|processing-instruction()">
<xsl:copy>
<xsl:apply-templates select="*|@*|text()|comment()|processing-instruction()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="boxed-text">
<sec>
<xsl:apply-templates select="@id"/>
<xsl:choose>
<xsl:when test="./label and ./caption/title">
<title>
<label><xsl:apply-templates select="./label/(*|text())"/></label>
<xsl:text> </xsl:text>
<xsl:apply-templates select="./caption/title/(*|text())"/>
</title>
</xsl:when>
<xsl:when test="./label">
<title>
<xsl:apply-templates select="./label/(*|text())"/>
</title>
</xsl:when>
<xsl:when test="./caption/title">
<title>
<xsl:apply-templates select="./caption/title/(*|text())"/>
</title>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
<xsl:if test="./caption/p">
<xsl:copy-of select="./caption/p"/>
</xsl:if>
<xsl:apply-templates select="*[not(name()=('label','caption'))]|text()|comment()|processing-instruction()"/>
</sec>
</xsl:template>
</xsl:stylesheet>