summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex4ht/xtpipes/docbook.4xt
blob: 816e67013a51cdf94974bfd07891790202063711 (plain)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE xtpipes SYSTEM "xtpipes.dtd" >
<xtpipes preamble="yes" signature="docbook.4xt (2008-08-25-15:33)">
   <sax content-handler="xtpipes.util.ScriptsManager"
        lexical-handler="xtpipes.util.ScriptsManagerLH" >
     <script element="ulink" >
   <set name="ulink" >
      <![CDATA[
   <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   >
      <xsl:output omit-xml-declaration = "yes" />

      <xsl:template match=" ulink[
   @url and starts-with( @url, '#')
]" >
   <link>
      <xsl:attribute name="linkend">
         <xsl:value-of select=" substring( @url, 2 )" />
      </xsl:attribute>
      <xsl:apply-templates select="*|text()|comment()" />
   </link>
</xsl:template>

            <xsl:template match="*|@*|text()|comment()" >
        <xsl:copy>
          <xsl:apply-templates select="*|@*|text()|comment()" />
        </xsl:copy>
      </xsl:template>
   </xsl:stylesheet>
]]>

   </set>
   <xslt name="." xml="." xsl="ulink" />
</script>

     <script element="tbody" >
   <set name="dirt" >
      <![CDATA[
   <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   >
      <xsl:output omit-xml-declaration = "yes" />

      <xsl:template match=" row[
  (count(child::entry) = 1)
 and
  ( normalize-space(child::entry[1]/child::para[1]/child::comment())
    = 'dirt'
  )
]">
</xsl:template>

            <xsl:template match="*|@*|text()|comment()" >
        <xsl:copy>
          <xsl:apply-templates select="*|@*|text()|comment()" />
        </xsl:copy>
      </xsl:template>
   </xsl:stylesheet>
]]>

   </set>
   <set name="tbody" >
      <![CDATA[
   <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   >
      <xsl:output omit-xml-declaration = "yes" />

      <xsl:template match=" row[ @role = 'hline' ]" />
<xsl:template match=" row[ @role = 'hline' ]" />
<xsl:template match=" row[
       following-sibling::*[1][ self::row[@role = 'hline'] ]
] ">
   <xsl:copy>
      <xsl:attribute name="rowsep">
         <xsl:text>1</xsl:text>
      </xsl:attribute>
      <xsl:apply-templates select="*|@*|text()|comment()" />
   </xsl:copy>
</xsl:template>
<xsl:template match=" row[
     (@role = 'cline')
     and
     preceding-sibling::*[1]
                         [ self::row[ not(@role) ] ]
     and
     (   count(child::entry)
       = count(preceding-sibling::*[1]/child::entry))
]" />
<xsl:template match=" row[
       not(@role)
   and
       following-sibling::*[1][ self::row[@role = 'cline'] ]
   and
     (   count(child::entry)
       = count(following-sibling::*[1]/child::entry))
] ">
   <xsl:copy>
      <xsl:apply-templates select="@*" />
      <xsl:apply-templates select="*|text()|comment()" mode="cline" />
   </xsl:copy>
</xsl:template>
<xsl:template match=" text()|comment() " mode="cline">
   <xsl:copy>
      <xsl:apply-templates select="*|@*|text()|comment()"  />
   </xsl:copy>
</xsl:template>
<xsl:template match="*" mode="cline">
   <xsl:copy>
      <xsl:if test="self::entry">
         <xsl:attribute name="rowsep">
             <xsl:variable name="pos">
                <xsl:value-of select="position()" />
             </xsl:variable>
             <xsl:value-of select="parent::row
                                   / following-sibling::*[1]
                                   / child::entry[position()=$pos]
                                   / @rowsep
                                    " />
          </xsl:attribute>
      </xsl:if>
      <xsl:apply-templates select="*|@*|text()|comment()"  />
   </xsl:copy>
</xsl:template>

            <xsl:template match="*|@*|text()|comment()" >
        <xsl:copy>
          <xsl:apply-templates select="*|@*|text()|comment()" />
        </xsl:copy>
      </xsl:template>
   </xsl:stylesheet>
]]>

   </set>
   <xslt name="." xml="." xsl="tbody" />
   <xslt name="." xml="." xsl="dirt" />
   <dom name="." xml="." method="cline" class="tex4ht.DbUtilities" />
</script>

   </sax>
</xtpipes>