source: trunk/Distribution/XSL/xhtml/html2xhtml.xsl@ 2

Last change on this file since 2 was 2, checked in by jkacer, 18 years ago

Added all DocBook Framework stuff:

  • DocBook DTD
  • Transformation software FOP 0.20.5 and Saxon 6
  • XSL styles
  • Rexx scripts

Also added some WarpIN-related stuff for creation of WarpIN installation packages.
This state corresponds to version 1.0.0 from November 2005, just slightly modified to carry versioning information (Rexx scripts).

File size: 5.1 KB
Line 
1<?xml version="1.0"?>
2<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:exsl="http://exslt.org/common"
4 exclude-result-prefixes="exsl"
5 version="1.0">
6
7<xsl:output method="xml" encoding="US-ASCII"/>
8<xsl:preserve-space elements="*"/>
9
10<xsl:template match="/">
11 <xsl:text>&#10;</xsl:text>
12 <xsl:comment>This file was created automatically by html2xhtml</xsl:comment>
13 <xsl:text>&#10;</xsl:text>
14 <xsl:comment>from the HTML stylesheets. Do not edit this file.</xsl:comment>
15 <xsl:text>&#10;</xsl:text>
16 <xsl:apply-templates/>
17 <xsl:text>&#10;</xsl:text>
18</xsl:template>
19
20<xsl:template match="xsl:stylesheet" >
21 <xsl:variable name="a">
22 <xsl:element name="dummy" namespace="http://www.w3.org/1999/xhtml"/>
23 </xsl:variable>
24 <xsl:copy>
25 <xsl:copy-of select="exsl:node-set($a)//namespace::*"/>
26 <xsl:copy-of select="@*"/>
27 <xsl:apply-templates/>
28 </xsl:copy>
29</xsl:template>
30
31<!-- Make sure we override some templates and parameters appropriately for XHTML -->
32<xsl:template match="xsl:output">
33 <xsl:copy>
34 <xsl:copy-of select="@*"/>
35 <xsl:attribute name="method">xml</xsl:attribute>
36 <xsl:attribute name="encoding">UTF-8</xsl:attribute>
37 <xsl:attribute name="doctype-public">-//W3C//DTD XHTML 1.0 Transitional//EN</xsl:attribute>
38 <xsl:attribute name="doctype-system">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</xsl:attribute>
39 </xsl:copy>
40</xsl:template>
41
42<xsl:template match="xsl:param[@name='stylesheet.result.type']">
43 <xsl:copy>
44 <xsl:copy-of select="@*"/>
45 <xsl:attribute name="select">'xhtml'</xsl:attribute>
46 </xsl:copy>
47</xsl:template>
48
49<xsl:template match="xsl:param[@name='make.valid.html']">
50 <xsl:copy>
51 <xsl:copy-of select="@*"/>
52 <xsl:attribute name="select">1</xsl:attribute>
53 </xsl:copy>
54</xsl:template>
55
56<xsl:template match="xsl:param[@name='output.method']">
57 <xsl:copy>
58 <xsl:copy-of select="@*"/>
59 <xsl:attribute name="select">'xml'</xsl:attribute>
60 </xsl:copy>
61</xsl:template>
62
63<xsl:template match="xsl:param[@name='chunker.output.method']">
64 <xsl:copy>
65 <xsl:copy-of select="@*"/>
66 <xsl:attribute name="select">'xml'</xsl:attribute>
67 </xsl:copy>
68</xsl:template>
69
70<xsl:template match="xsl:param[@name='chunker.output.encoding']">
71 <xsl:copy>
72 <xsl:copy-of select="@*"/>
73 <xsl:attribute name="select">'UTF-8'</xsl:attribute>
74 </xsl:copy>
75</xsl:template>
76
77<xsl:template match="xsl:param[@name='chunker.output.doctype-public']">
78 <xsl:copy>
79 <xsl:copy-of select="@*"/>
80 <xsl:attribute name="select">'-//W3C//DTD XHTML 1.0 Transitional//EN'</xsl:attribute>
81 </xsl:copy>
82</xsl:template>
83
84<xsl:template match="xsl:param[@name='chunker.output.doctype-system']">
85 <xsl:copy>
86 <xsl:copy-of select="@*"/>
87 <xsl:attribute name="select">'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'</xsl:attribute>
88 </xsl:copy>
89</xsl:template>
90
91<xsl:template match="xsl:attribute[@name='name']">
92 <xsl:choose>
93 <xsl:when test="ancestor::a">
94 <xsl:copy>
95 <xsl:copy-of select="@*"/>
96 <xsl:attribute name="name">id</xsl:attribute>
97 <xsl:apply-templates/>
98 </xsl:copy>
99 </xsl:when>
100 <xsl:otherwise>
101 <xsl:copy>
102 <xsl:copy-of select="@*"/>
103 <xsl:apply-templates/>
104 </xsl:copy>
105 </xsl:otherwise>
106 </xsl:choose>
107</xsl:template>
108
109<xsl:template match="xsl:element">
110 <!-- make sure literal xsl:element declarations propagate the right namespace -->
111 <xsl:copy>
112 <xsl:copy-of select="@*"/>
113 <xsl:attribute name="namespace">http://www.w3.org/1999/xhtml</xsl:attribute>
114 <xsl:apply-templates/>
115 </xsl:copy>
116</xsl:template>
117
118<xsl:template match="xsl:template[@name='body.attributes']">
119 <xsl:copy>
120 <xsl:copy-of select="@*"/>
121 <xsl:text>&#10;</xsl:text>
122 <xsl:comment> no apply-templates; make it empty </xsl:comment>
123 <xsl:text>&#10;</xsl:text>
124 </xsl:copy>
125</xsl:template>
126
127<!-- this only occurs in docbook.xsl to identify errors -->
128<xsl:template match="font">
129 <span class="ERROR" xmlns="http://www.w3.org/1999/xhtml">
130 <xsl:apply-templates/>
131 </span>
132</xsl:template>
133
134<!-- this only occurs in docbook.xsl to identify errors -->
135<xsl:template match="a[@name]">
136 <xsl:element name="{local-name(.)}" namespace="http://www.w3.org/1999/xhtml">
137 <xsl:attribute name="id"><xsl:value-of select="@name"/></xsl:attribute>
138 <xsl:for-each select="@*">
139 <xsl:if test="local-name(.) != 'name'">
140 <xsl:attribute name="{name(.)}"><xsl:value-of select="."/></xsl:attribute>
141 </xsl:if>
142 </xsl:for-each>
143 <xsl:apply-templates/>
144 </xsl:element>
145</xsl:template>
146
147<xsl:template match="*">
148 <xsl:choose>
149 <xsl:when test="namespace-uri(.) = ''">
150 <xsl:element name="{local-name(.)}" namespace="http://www.w3.org/1999/xhtml">
151 <xsl:copy-of select="@*"/>
152 <xsl:apply-templates/>
153 </xsl:element>
154 </xsl:when>
155 <xsl:otherwise>
156 <xsl:copy>
157 <xsl:copy-of select="@*"/>
158 <xsl:apply-templates/>
159 </xsl:copy>
160 </xsl:otherwise>
161 </xsl:choose>
162</xsl:template>
163
164<xsl:template match="comment()|processing-instruction()|text()">
165 <xsl:copy/>
166</xsl:template>
167
168</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.