Revision 851
Added by Matt Jones about 23 years ago
lib/style/ie5-default-ss.xsl | ||
---|---|---|
1 |
<?xml version="1.0"?> |
|
2 |
<?xml-stylesheet type="text/xsl" href="defaultss.xsl"?> |
|
3 | 1 |
<!-- |
4 |
IE5 default style sheet, provides a view of any XML document |
|
5 |
and provides the following features: |
|
6 |
- auto-indenting of the display, expanding of entity references |
|
7 |
- click or tab/return to expand/collapse |
|
8 |
- color coding of markup |
|
9 |
- color coding of recognized namespaces - xml, xmlns, xsl, dt |
|
10 |
|
|
11 |
This style sheet is available in IE5 in a compact form at the URL |
|
12 |
"res://msxml.dll/DEFAULTSS.xsl". This version differs only in the |
|
13 |
addition of comments and whitespace for readability. |
|
14 |
|
|
15 |
Author: Jonathan Marsh (jmarsh@microsoft.com) |
|
16 |
--> |
|
2 |
| |
|
3 |
| XSLT REC Compliant Version of IE5 Default Stylesheet |
|
4 |
| |
|
5 |
| Original version by Jonathan Marsh (jmarsh@microsoft.com) |
|
6 |
| http://msdn.microsoft.com/xml/samples/defaultss/defaultss.xsl |
|
7 |
| |
|
8 |
| Conversion to XSLT 1.0 REC Syntax by Steve Muench (smuench@oracle.com) |
|
9 |
| |
|
10 |
+--> |
|
11 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> |
|
12 |
<xsl:output indent="no" method="html"/> |
|
17 | 13 |
|
18 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" |
|
19 |
xmlns:dt="urn:schemas-microsoft-com:datatypes" |
|
20 |
xmlns:d2="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"> |
|
21 |
|
|
22 |
<xsl:template match="/"> |
|
23 |
<HTML> |
|
24 |
<HEAD> |
|
25 |
<STYLE> |
|
26 |
BODY {font:x-small 'Verdana'; margin-right:1.5em} |
|
27 |
<!-- container for expanding/collapsing content --> |
|
28 |
.c {cursor:hand} |
|
29 |
<!-- button - contains +/-/nbsp --> |
|
30 |
.b {color:red; font-family:'Courier New'; font-weight:bold; text-decoration:none} |
|
31 |
<!-- element container --> |
|
32 |
.e {margin-left:1em; text-indent:-1em; margin-right:1em} |
|
33 |
<!-- comment or cdata --> |
|
34 |
.k {margin-left:1em; text-indent:-1em; margin-right:1em} |
|
35 |
<!-- tag --> |
|
36 |
.t {color:#990000} |
|
37 |
<!-- tag in xsl namespace --> |
|
38 |
.xt {color:#990099} |
|
39 |
<!-- attribute in xml or xmlns namespace --> |
|
40 |
.ns {color:red} |
|
41 |
<!-- attribute in dt namespace --> |
|
42 |
.dt {color:green} |
|
43 |
<!-- markup characters --> |
|
44 |
.m {color:blue} |
|
45 |
<!-- text node --> |
|
46 |
.tx {font-weight:bold} |
|
47 |
<!-- multi-line (block) cdata --> |
|
48 |
.db {text-indent:0px; margin-left:1em; margin-top:0px; margin-bottom:0px; |
|
49 |
padding-left:.3em; border-left:1px solid #CCCCCC; font:small Courier} |
|
50 |
<!-- single-line (inline) cdata --> |
|
51 |
.di {font:small Courier} |
|
52 |
<!-- DOCTYPE declaration --> |
|
53 |
.d {color:blue} |
|
54 |
<!-- pi --> |
|
55 |
.pi {color:blue} |
|
56 |
<!-- multi-line (block) comment --> |
|
57 |
.cb {text-indent:0px; margin-left:1em; margin-top:0px; margin-bottom:0px; |
|
58 |
padding-left:.3em; font:small Courier; color:#888888} |
|
59 |
<!-- single-line (inline) comment --> |
|
60 |
.ci {font:small Courier; color:#888888} |
|
61 |
PRE {margin:0px; display:inline} |
|
62 |
</STYLE> |
|
63 |
|
|
64 |
<SCRIPT><xsl:comment><![CDATA[ |
|
65 |
// Detect and switch the display of CDATA and comments from an inline view |
|
66 |
// to a block view if the comment or CDATA is multi-line. |
|
67 |
function f(e) |
|
68 |
{ |
|
69 |
// if this element is an inline comment, and contains more than a single |
|
70 |
// line, turn it into a block comment. |
|
71 |
if (e.className == "ci") { |
|
72 |
if (e.children(0).innerText.indexOf("\n") > 0) |
|
73 |
fix(e, "cb"); |
|
14 |
<xsl:template match="/"> |
|
15 |
<HTML> |
|
16 |
<HEAD> |
|
17 |
<SCRIPT> |
|
18 |
<xsl:comment><![CDATA[ |
|
19 |
function f(e){ |
|
20 |
if (e.className=="ci") { |
|
21 |
if (e.children(0).innerText.indexOf("\n")>0) fix(e,"cb"); |
|
22 |
} |
|
23 |
if (e.className=="di") { |
|
24 |
if (e.children(0).innerText.indexOf("\n")>0) fix(e,"db"); |
|
25 |
} e.id=""; |
|
26 |
} |
|
27 |
function fix(e,cl){ |
|
28 |
e.className=cl; |
|
29 |
e.style.display="block"; |
|
30 |
j=e.parentElement.children(0); |
|
31 |
j.className="c"; |
|
32 |
k=j.children(0); |
|
33 |
k.style.visibility="visible"; |
|
34 |
k.href="#"; |
|
35 |
} |
|
36 |
function ch(e) { |
|
37 |
mark=e.children(0).children(0); |
|
38 |
if (mark.innerText=="+") { |
|
39 |
mark.innerText="-"; |
|
40 |
for (var i=1;i<e.children.length;i++) { |
|
41 |
e.children(i).style.display="block"; |
|
74 | 42 |
} |
75 |
|
|
76 |
// if this element is an inline cdata, and contains more than a single |
|
77 |
// line, turn it into a block cdata. |
|
78 |
if (e.className == "di") { |
|
79 |
if (e.children(0).innerText.indexOf("\n") > 0) |
|
80 |
fix(e, "db"); |
|
81 |
} |
|
82 |
|
|
83 |
// remove the id since we only used it for cleanup |
|
84 |
e.id = ""; |
|
85 | 43 |
} |
86 |
|
|
87 |
// Fix up the element as a "block" display and enable expand/collapse on it |
|
88 |
function fix(e, cl) |
|
89 |
{ |
|
90 |
// change the class name and display value |
|
91 |
e.className = cl; |
|
92 |
e.style.display = "block"; |
|
93 |
|
|
94 |
// mark the comment or cdata display as a expandable container |
|
95 |
j = e.parentElement.children(0); |
|
96 |
j.className = "c"; |
|
97 |
|
|
98 |
// find the +/- symbol and make it visible - the dummy link enables tabbing |
|
99 |
k = j.children(0); |
|
100 |
k.style.visibility = "visible"; |
|
101 |
k.href = "#"; |
|
102 |
} |
|
103 |
|
|
104 |
// Change the +/- symbol and hide the children. This function works on "element" |
|
105 |
// displays |
|
106 |
function ch(e) |
|
107 |
{ |
|
108 |
// find the +/- symbol |
|
109 |
mark = e.children(0).children(0); |
|
110 |
|
|
111 |
// if it is already collapsed, expand it by showing the children |
|
112 |
if (mark.innerText == "+") |
|
113 |
{ |
|
114 |
mark.innerText = "-"; |
|
115 |
for (var i = 1; i < e.children.length; i++) |
|
116 |
e.children(i).style.display = "block"; |
|
44 |
else if (mark.innerText=="-") { |
|
45 |
mark.innerText="+"; |
|
46 |
for (var i=1;i<e.children.length;i++) { |
|
47 |
e.children(i).style.display="none"; |
|
117 | 48 |
} |
118 |
|
|
119 |
// if it is expanded, collapse it by hiding the children |
|
120 |
else if (mark.innerText == "-") |
|
121 |
{ |
|
122 |
mark.innerText = "+"; |
|
123 |
for (var i = 1; i < e.children.length; i++) |
|
124 |
e.children(i).style.display="none"; |
|
125 |
} |
|
126 | 49 |
} |
127 |
|
|
128 |
// Change the +/- symbol and hide the children. This function work on "comment" |
|
129 |
// and "cdata" displays |
|
130 |
function ch2(e) |
|
131 |
{ |
|
132 |
// find the +/- symbol, and the "PRE" element that contains the content |
|
133 |
mark = e.children(0).children(0); |
|
134 |
contents = e.children(1); |
|
135 |
|
|
136 |
// if it is already collapsed, expand it by showing the children |
|
137 |
if (mark.innerText == "+") |
|
138 |
{ |
|
139 |
mark.innerText = "-"; |
|
140 |
// restore the correct "block"/"inline" display type to the PRE |
|
141 |
if (contents.className == "db" || contents.className == "cb") |
|
142 |
contents.style.display = "block"; |
|
143 |
else contents.style.display = "inline"; |
|
50 |
} |
|
51 |
function ch2(e) { |
|
52 |
mark=e.children(0).children(0); |
|
53 |
contents=e.children(1); |
|
54 |
if (mark.innerText=="+") { |
|
55 |
mark.innerText="-"; |
|
56 |
if (contents.className=="db"||contents.className=="cb") { |
|
57 |
contents.style.display="block"; |
|
144 | 58 |
} |
145 |
|
|
146 |
// if it is expanded, collapse it by hiding the children |
|
147 |
else if (mark.innerText == "-") |
|
148 |
{ |
|
149 |
mark.innerText = "+"; |
|
150 |
contents.style.display = "none"; |
|
59 |
else { |
|
60 |
contents.style.display="inline"; |
|
151 | 61 |
} |
152 | 62 |
} |
153 |
|
|
154 |
// Handle a mouse click |
|
155 |
function cl() |
|
156 |
{ |
|
157 |
e = window.event.srcElement; |
|
158 |
|
|
159 |
// make sure we are handling clicks upon expandable container elements |
|
160 |
if (e.className != "c") |
|
161 |
{ |
|
162 |
e = e.parentElement; |
|
163 |
if (e.className != "c") |
|
164 |
{ |
|
165 |
return; |
|
166 |
} |
|
63 |
else if (mark.innerText=="-") { |
|
64 |
mark.innerText="+"; |
|
65 |
contents.style.display="none"; |
|
66 |
} |
|
67 |
} |
|
68 |
function cl() { |
|
69 |
e=window.event.srcElement; |
|
70 |
if (e.className!="c") { |
|
71 |
e=e.parentElement; |
|
72 |
if (e.className!="c") { |
|
73 |
return; |
|
167 | 74 |
} |
168 |
e = e.parentElement; |
|
169 |
|
|
170 |
// call the correct funtion to change the collapse/expand state and display |
|
171 |
if (e.className == "e") |
|
172 |
ch(e); |
|
173 |
if (e.className == "k") |
|
174 |
ch2(e); |
|
175 | 75 |
} |
76 |
e=e.parentElement; |
|
77 |
if (e.className=="e") { |
|
78 |
ch(e); |
|
79 |
} |
|
80 |
if (e.className=="k") { |
|
81 |
ch2(e); |
|
82 |
} |
|
83 |
} |
|
84 |
function ex(){} |
|
85 |
function h(){window.status=" ";} |
|
86 |
document.onclick=cl; |
|
87 |
]]> |
|
88 |
</xsl:comment> |
|
89 |
</SCRIPT> |
|
90 |
|
|
91 |
<STYLE> |
|
92 |
BODY {font:x-small 'Verdana'; margin-right:1.5em} |
|
93 |
.c {cursor:hand} |
|
94 |
.b {color:red; font-family:'Courier New'; font-weight:bold; |
|
95 |
text-decoration:none} |
|
96 |
.e {margin-left:1em; text-indent:-1em; margin-right:1em} |
|
97 |
.k {margin-left:1em; text-indent:-1em; margin-right:1em} |
|
98 |
.t {color:#990000} |
|
99 |
.xt {color:#990099} |
|
100 |
.ns {color:red} |
|
101 |
.dt {color:green} |
|
102 |
.m {color:blue} |
|
103 |
.tx {font-weight:bold} |
|
104 |
.db {text-indent:0px; margin-left:1em; margin-top:0px; |
|
105 |
margin-bottom:0px;padding-left:.3em; |
|
106 |
border-left:1px solid #CCCCCC; font:small Courier} |
|
107 |
.di {font:small Courier} |
|
108 |
.d {color:blue} |
|
109 |
.pi {color:blue} |
|
110 |
.cb {text-indent:0px; margin-left:1em; margin-top:0px; |
|
111 |
margin-bottom:0px;padding-left:.3em; font:small Courier; |
|
112 |
color:#888888} |
|
113 |
.ci {font:small Courier; color:#888888} |
|
114 |
PRE {margin:0px; display:inline} |
|
115 |
</STYLE> |
|
116 |
</HEAD> |
|
117 |
<BODY class="st"> |
|
118 |
<xsl:apply-templates/> |
|
119 |
</BODY> |
|
120 |
</HTML> |
|
121 |
</xsl:template> |
|
176 | 122 |
|
177 |
// Dummy function for expand/collapse link navigation - trap onclick events instead |
|
178 |
function ex() |
|
179 |
{} |
|
123 |
<xsl:template match="processing-instruction()"> |
|
124 |
<DIV class="e"> |
|
125 |
<SPAN class="b"> |
|
126 |
<xsl:call-template name="entity-ref"> |
|
127 |
<xsl:with-param |
|
128 |
name="name">nbsp</xsl:with-param> |
|
129 |
</xsl:call-template> |
|
130 |
</SPAN> |
|
131 |
<SPAN class="m"> |
|
132 |
<xsl:text><?</xsl:text> |
|
133 |
</SPAN> |
|
134 |
<SPAN class="pi"> |
|
135 |
<xsl:value-of select="name(.)"/> |
|
136 |
<xsl:value-of select="."/> |
|
137 |
</SPAN> |
|
138 |
<SPAN class="m"> |
|
139 |
<xsl:text>?></xsl:text> |
|
140 |
</SPAN> |
|
141 |
</DIV> |
|
142 |
</xsl:template> |
|
180 | 143 |
|
181 |
// Erase bogus link info from the status window |
|
182 |
function h() |
|
183 |
{ |
|
184 |
window.status=" "; |
|
185 |
} |
|
144 |
<xsl:template match="processing-instruction('xml')"> |
|
145 |
<DIV class="e"> |
|
146 |
<SPAN class="b"> |
|
147 |
<xsl:call-template name="entity-ref"> |
|
148 |
<xsl:with-param |
|
149 |
name="name">nbsp</xsl:with-param> |
|
150 |
</xsl:call-template> |
|
151 |
</SPAN> |
|
152 |
<SPAN class="m"> |
|
153 |
<xsl:text><?</xsl:text> |
|
154 |
</SPAN> |
|
155 |
<SPAN class="pi"> |
|
156 |
<xsl:text>xml </xsl:text> |
|
157 |
<xsl:for-each select="@*"> |
|
158 |
<xsl:value-of select="name(.)"/> |
|
159 |
<xsl:text>="</xsl:text> |
|
160 |
<xsl:value-of select="."/> |
|
161 |
<xsl:text>" </xsl:text> |
|
162 |
</xsl:for-each> |
|
163 |
</SPAN> |
|
164 |
<SPAN class="m"> |
|
165 |
<xsl:text>?></xsl:text> |
|
166 |
</SPAN> |
|
167 |
</DIV> |
|
168 |
</xsl:template> |
|
186 | 169 |
|
187 |
// Set the onclick handler |
|
188 |
document.onclick = cl; |
|
189 |
|
|
190 |
]]></xsl:comment></SCRIPT> |
|
191 |
</HEAD> |
|
170 |
<xsl:template match="@*"> |
|
171 |
<SPAN> |
|
172 |
<xsl:attribute name="class"> |
|
173 |
<xsl:if test="xsl:*/@*"> |
|
174 |
<xsl:text>x</xsl:text> |
|
175 |
</xsl:if> |
|
176 |
<xsl:text>t</xsl:text> |
|
177 |
</xsl:attribute> |
|
178 |
<xsl:value-of select="name(.)"/> |
|
179 |
</SPAN> |
|
180 |
<SPAN class="m">="</SPAN> |
|
181 |
<B> |
|
182 |
<xsl:value-of select="."/> |
|
183 |
</B> |
|
184 |
<SPAN class="m">"</SPAN> |
|
185 |
</xsl:template> |
|
192 | 186 |
|
193 |
<BODY class="st"><xsl:apply-templates/></BODY> |
|
187 |
<xsl:template match="text()"> |
|
188 |
<DIV class="e"> |
|
189 |
<SPAN class="b"> </SPAN> |
|
190 |
<SPAN class="tx"> |
|
191 |
<xsl:value-of select="."/> |
|
192 |
</SPAN> |
|
193 |
</DIV> |
|
194 |
</xsl:template> |
|
194 | 195 |
|
195 |
</HTML> |
|
196 |
</xsl:template> |
|
196 |
<xsl:template match="comment()"> |
|
197 |
<DIV class="k"> |
|
198 |
<SPAN> |
|
199 |
<A STYLE="visibility:hidden" |
|
200 |
class="b" onclick="return false" |
|
201 |
onfocus="h()">-</A> |
|
202 |
<SPAN class="m"> |
|
203 |
<xsl:text><!--</xsl:text> |
|
204 |
</SPAN> |
|
205 |
</SPAN> |
|
206 |
<SPAN class="ci" id="clean"> |
|
207 |
<PRE> |
|
208 |
<xsl:value-of select="."/> |
|
209 |
</PRE> |
|
210 |
</SPAN> |
|
211 |
<SPAN class="b"> |
|
212 |
<xsl:call-template |
|
213 |
name="entity-ref"> |
|
214 |
<xsl:with-param |
|
215 |
name="name">nbsp</xsl:with-param> |
|
216 |
</xsl:call-template> |
|
217 |
</SPAN> |
|
218 |
<SPAN class="m"> |
|
219 |
<xsl:text>--></xsl:text> |
|
220 |
</SPAN> |
|
221 |
<SCRIPT>f(clean);</SCRIPT> |
|
222 |
</DIV> |
|
223 |
</xsl:template> |
|
197 | 224 |
|
198 |
<!-- Templates for each node type follows. The output of each template has a similar structure |
|
199 |
to enable script to walk the result tree easily for handling user interaction. --> |
|
200 |
|
|
201 |
<!-- Template for the DOCTYPE declaration. No way to get the DOCTYPE, so we just put in a placeholder --> |
|
202 |
<!-- |
|
203 |
<xsl:template match="node()[nodeType()=10]"> |
|
204 |
<DIV class="e"><SPAN> |
|
205 |
<SPAN class="b"><xsl:entity-ref name="nbsp"/></SPAN> |
|
206 |
<SPAN class="d"><!DOCTYPE <xsl:node-name/><I> (View Source for full doctype...)</I>></SPAN> |
|
207 |
</SPAN></DIV> |
|
208 |
</xsl:template> |
|
209 |
--> |
|
210 |
<!-- Template for pis not handled elsewhere --> |
|
211 |
<!-- |
|
212 |
<xsl:template match="pi()"> |
|
213 |
<DIV class="e"> |
|
214 |
<SPAN class="b"><xsl:entity-ref name="nbsp"/></SPAN> |
|
215 |
<SPAN class="m"><?</SPAN><SPAN class="pi"><xsl:node-name/> <xsl:value-of/></SPAN><SPAN class="m">?></SPAN> |
|
216 |
</DIV> |
|
217 |
</xsl:template> |
|
225 |
<xsl:template match="*"> |
|
226 |
<DIV class="e"> |
|
227 |
<DIV STYLE="margin-left:1em;text-indent:-2em"> |
|
228 |
<SPAN class="b"> |
|
229 |
<xsl:call-template |
|
230 |
name="entity-ref"> |
|
231 |
<xsl:with-param |
|
232 |
name="name">nbsp</xsl:with-param> |
|
233 |
</xsl:call-template> |
|
234 |
</SPAN> |
|
235 |
<SPAN class="m"><</SPAN> |
|
236 |
<SPAN> |
|
237 |
<xsl:attribute name="class"> |
|
238 |
<xsl:if test="xsl:*"> |
|
239 |
<xsl:text>x</xsl:text> |
|
240 |
</xsl:if> |
|
241 |
<xsl:text>t</xsl:text> |
|
242 |
</xsl:attribute> |
|
243 |
<xsl:value-of select="name(.)"/> |
|
244 |
<xsl:if test="@*"> |
|
245 |
<xsl:text> </xsl:text> |
|
246 |
</xsl:if> |
|
247 |
</SPAN> |
|
248 |
<xsl:apply-templates select="@*"/> |
|
249 |
<SPAN class="m"> |
|
250 |
<xsl:text>/></xsl:text> |
|
251 |
</SPAN> |
|
252 |
</DIV> |
|
253 |
</DIV> |
|
254 |
</xsl:template> |
|
218 | 255 |
|
219 |
--> |
|
220 |
<!-- Template for the XML declaration. Need a separate template because the pseudo-attributes |
|
221 |
are actually exposed as attributes instead of just element content, as in other pis --> |
|
222 |
<!-- |
|
223 |
<xsl:template match="pi('xml')"> |
|
224 |
<DIV class="e"> |
|
225 |
<SPAN class="b"><xsl:entity-ref name="nbsp"/></SPAN> |
|
226 |
<SPAN class="m"><?</SPAN><SPAN class="pi">xml <xsl:for-each select="@*"><xsl:node-name/>="<xsl:value-of/>" </xsl:for-each></SPAN><SPAN class="m">?></SPAN> |
|
227 |
</DIV> |
|
228 |
</xsl:template> |
|
229 |
--> |
|
230 |
<!-- Template for attributes not handled elsewhere --> |
|
231 |
<xsl:template match="@*" xml:space="preserve"><SPAN><xsl:attribute name="class"><xsl:if match="xsl:*/@*">x</xsl:if>t</xsl:attribute> <xsl:node-name/></SPAN><SPAN class="m">="</SPAN><B><xsl:value-of/></B><SPAN class="m">"</SPAN></xsl:template> |
|
256 |
<xsl:template match="*[node()]"> |
|
257 |
<DIV class="e"> |
|
258 |
<DIV class="c"> |
|
259 |
<A class="b" href="#" |
|
260 |
onclick="return false" onfocus="h()">-</A> |
|
261 |
<SPAN class="m"><</SPAN> |
|
262 |
<SPAN> |
|
263 |
<xsl:attribute name="class"> |
|
264 |
<xsl:if test="xsl:*"> |
|
265 |
<xsl:text>x</xsl:text> |
|
266 |
</xsl:if> |
|
267 |
<xsl:text>t</xsl:text> |
|
268 |
</xsl:attribute> |
|
269 |
<xsl:value-of select="name(.)"/> |
|
270 |
<xsl:if test="@*"> |
|
271 |
<xsl:text> </xsl:text> |
|
272 |
</xsl:if> |
|
273 |
</SPAN> |
|
274 |
<xsl:apply-templates select="@*"/> |
|
275 |
<SPAN class="m"> |
|
276 |
<xsl:text>></xsl:text> |
|
277 |
</SPAN> |
|
278 |
</DIV> |
|
279 |
<DIV> |
|
280 |
<xsl:apply-templates/> |
|
281 |
<DIV> |
|
282 |
<SPAN class="b"> |
|
283 |
<xsl:call-template name="entity-ref"> |
|
284 |
<xsl:with-param |
|
285 |
name="name">nbsp</xsl:with-param> |
|
286 |
</xsl:call-template> |
|
287 |
</SPAN> |
|
288 |
<SPAN class="m"> |
|
289 |
<xsl:text></</xsl:text> |
|
290 |
</SPAN> |
|
291 |
<SPAN> |
|
292 |
<xsl:attribute name="class"> |
|
293 |
<xsl:if test="xsl:*"> |
|
294 |
<xsl:text>x</xsl:text> |
|
295 |
</xsl:if> |
|
296 |
<xsl:text>t</xsl:text> |
|
297 |
</xsl:attribute> |
|
298 |
<xsl:value-of select="name(.)"/> |
|
299 |
</SPAN> |
|
300 |
<SPAN class="m"> |
|
301 |
<xsl:text>></xsl:text> |
|
302 |
</SPAN> |
|
303 |
</DIV> |
|
304 |
</DIV> |
|
305 |
</DIV> |
|
306 |
</xsl:template> |
|
232 | 307 |
|
233 |
<!-- Template for attributes in the xmlns or xml namespace --> |
|
234 |
<xsl:template match="@xmlns:*|@xmlns|@xml:*"><SPAN class="ns"> <xsl:node-name/></SPAN><SPAN class="m">="</SPAN><B class="ns"><xsl:value-of/></B><SPAN class="m">"</SPAN></xsl:template> |
|
308 |
<xsl:template match="*[text() and |
|
309 |
not (comment() or processing-instruction())]"> |
|
310 |
<DIV class="e"> |
|
311 |
<DIV STYLE="margin-left:1em;text-indent:-2em"> |
|
312 |
<SPAN class="b"> |
|
313 |
<xsl:call-template name="entity-ref"> |
|
314 |
<xsl:with-param |
|
315 |
name="name">nbsp</xsl:with-param> |
|
316 |
</xsl:call-template> |
|
317 |
</SPAN> |
|
318 |
<SPAN class="m"> |
|
319 |
<xsl:text><</xsl:text> |
|
320 |
</SPAN> |
|
321 |
<SPAN> |
|
322 |
<xsl:attribute name="class"> |
|
323 |
<xsl:if test="xsl:*"> |
|
324 |
<xsl:text>x</xsl:text> |
|
325 |
</xsl:if> |
|
326 |
<xsl:text>t</xsl:text> |
|
327 |
</xsl:attribute> |
|
328 |
<xsl:value-of select="name(.)"/> |
|
329 |
<xsl:if test="@*"> |
|
330 |
<xsl:text> </xsl:text> |
|
331 |
</xsl:if> |
|
332 |
</SPAN> |
|
333 |
<xsl:apply-templates select="@*"/> |
|
334 |
<SPAN class="m"> |
|
335 |
<xsl:text>></xsl:text> |
|
336 |
</SPAN> |
|
337 |
<SPAN class="tx"> |
|
338 |
<xsl:value-of select="."/> |
|
339 |
</SPAN> |
|
340 |
<SPAN class="m"></</SPAN> |
|
341 |
<SPAN> |
|
342 |
<xsl:attribute name="class"> |
|
343 |
<xsl:if test="xsl:*"> |
|
344 |
<xsl:text>x</xsl:text> |
|
345 |
</xsl:if> |
|
346 |
<xsl:text>t</xsl:text> |
|
347 |
</xsl:attribute> |
|
348 |
<xsl:value-of select="name(.)"/> |
|
349 |
</SPAN> |
|
350 |
<SPAN class="m"> |
|
351 |
<xsl:text>></xsl:text> |
|
352 |
</SPAN> |
|
353 |
</DIV> |
|
354 |
</DIV> |
|
355 |
</xsl:template> |
|
235 | 356 |
|
236 |
<!-- Template for attributes in the dt namespace --> |
|
237 |
<xsl:template match="@dt:*|@d2:*"><SPAN class="dt"> <xsl:node-name/></SPAN><SPAN class="m">="</SPAN><B class="dt"><xsl:value-of/></B><SPAN class="m">"</SPAN></xsl:template> |
|
357 |
<xsl:template match="*[*]" priority="20"> |
|
358 |
<DIV class="e"> |
|
359 |
<DIV STYLE="margin-left:1em;text-indent:-2em" class="c"> |
|
360 |
<A class="b" href="#" |
|
361 |
onclick="return false" onfocus="h()">-</A> |
|
362 |
<SPAN class="m"><</SPAN> |
|
363 |
<SPAN> |
|
364 |
<xsl:attribute name="class"> |
|
365 |
<xsl:if test="xsl:*"> |
|
366 |
<xsl:text>x</xsl:text> |
|
367 |
</xsl:if> |
|
368 |
<xsl:text>t</xsl:text> |
|
369 |
</xsl:attribute> |
|
370 |
<xsl:value-of select="name(.)"/> |
|
371 |
<xsl:if test="@*"> |
|
372 |
<xsl:text> </xsl:text> |
|
373 |
</xsl:if> |
|
374 |
</SPAN> |
|
375 |
<xsl:apply-templates select="@*"/> |
|
376 |
<SPAN class="m"> |
|
377 |
<xsl:text>></xsl:text> |
|
378 |
</SPAN> |
|
379 |
</DIV> |
|
380 |
<DIV> |
|
381 |
<xsl:apply-templates/> |
|
382 |
<DIV> |
|
383 |
<SPAN class="b"> |
|
384 |
<xsl:call-template name="entity-ref"> |
|
385 |
<xsl:with-param |
|
386 |
name="name">nbsp</xsl:with-param> |
|
387 |
</xsl:call-template> |
|
388 |
</SPAN> |
|
389 |
<SPAN class="m"> |
|
390 |
<xsl:text></</xsl:text> |
|
391 |
</SPAN> |
|
392 |
<SPAN> |
|
393 |
<xsl:attribute name="class"> |
|
394 |
<xsl:if test="xsl:*"> |
|
395 |
<xsl:text>x</xsl:text> |
|
396 |
</xsl:if> |
|
397 |
<xsl:text>t</xsl:text> |
|
398 |
</xsl:attribute> |
|
399 |
<xsl:value-of select="name(.)"/> |
|
400 |
</SPAN> |
|
401 |
<SPAN class="m"> |
|
402 |
<xsl:text>></xsl:text> |
|
403 |
</SPAN> |
|
404 |
</DIV> |
|
405 |
</DIV> |
|
406 |
</DIV> |
|
407 |
</xsl:template> |
|
238 | 408 |
|
239 |
<!-- Template for text nodes -->
|
|
240 |
<xsl:template match="textNode()">
|
|
241 |
<DIV class="e">
|
|
242 |
<SPAN class="b"><xsl:entity-ref name="nbsp"/></SPAN>
|
|
243 |
<SPAN class="tx"><xsl:value-of/></SPAN>
|
|
244 |
</DIV>
|
|
245 |
</xsl:template> |
|
409 |
<xsl:template name="entity-ref">
|
|
410 |
<xsl:param name="name"/>
|
|
411 |
<xsl:text
|
|
412 |
disable-output-escaping="yes">&</xsl:text>
|
|
413 |
<xsl:value-of select="$name"/>
|
|
414 |
<xsl:text>;</xsl:text>
|
|
415 |
</xsl:template>
|
|
246 | 416 |
|
247 |
|
|
248 |
<!-- Note that in the following templates for comments and cdata, by default we apply a style |
|
249 |
appropriate for single line content (e.g. non-expandable, single line display). But we also |
|
250 |
inject the attribute 'id="clean"' and a script call 'f(clean)'. As the output is read by the |
|
251 |
browser, it executes the function immediately. The function checks to see if the comment or |
|
252 |
cdata has multi-line data, in which case it changes the style to a expandable, multi-line |
|
253 |
display. Performing this switch in the DHTML instead of from script in the XSL increases |
|
254 |
the performance of the style sheet, especially in the browser's asynchronous case --> |
|
255 |
|
|
256 |
<!-- Template for comment nodes --> |
|
257 |
<xsl:template match="comment()"> |
|
258 |
<DIV class="k"> |
|
259 |
<SPAN><A class="b" onclick="return false" onfocus="h()" STYLE="visibility:hidden">-</A> <SPAN class="m"><!--</SPAN></SPAN> |
|
260 |
<SPAN id="clean" class="ci"><PRE><xsl:value-of/></PRE></SPAN> |
|
261 |
<SPAN class="b"><xsl:entity-ref name="nbsp"/></SPAN> <SPAN class="m">--></SPAN> |
|
262 |
<SCRIPT>f(clean);</SCRIPT></DIV> |
|
263 |
</xsl:template> |
|
264 |
|
|
265 |
<!-- Template for cdata nodes --> |
|
266 |
<xsl:template match="cdata()"> |
|
267 |
<DIV class="k"> |
|
268 |
<SPAN><A class="b" onclick="return false" onfocus="h()" STYLE="visibility:hidden">-</A> <SPAN class="m"><![CDATA[</SPAN></SPAN> |
|
269 |
<SPAN id="clean" class="di"><PRE><xsl:value-of/></PRE></SPAN> |
|
270 |
<SPAN class="b"><xsl:entity-ref name="nbsp"/></SPAN> <SPAN class="m">]]></SPAN> |
|
271 |
<SCRIPT>f(clean);</SCRIPT></DIV> |
|
272 |
</xsl:template> |
|
273 |
|
|
274 |
|
|
275 |
<!-- Note the following templates for elements may examine children. This harms to some extent |
|
276 |
the ability to process a document asynchronously - we can't process an element until we have |
|
277 |
read and examined at least some of its children. Specifically, the first element child must |
|
278 |
be read before any template can be chosen. And any element that does not have element |
|
279 |
children must be read completely before the correct template can be chosen. This seems |
|
280 |
an acceptable performance loss in the light of the formatting possibilities available |
|
281 |
when examining children. --> |
|
282 |
|
|
283 |
<!-- Template for elements not handled elsewhere (leaf nodes) --> |
|
284 |
<xsl:template match="*"> |
|
285 |
<DIV class="e"><DIV STYLE="margin-left:1em;text-indent:-2em"> |
|
286 |
<SPAN class="b"><xsl:entity-ref name="nbsp"/></SPAN> |
|
287 |
<SPAN class="m"><</SPAN><SPAN><xsl:attribute name="class"><xsl:if match="xsl:*">x</xsl:if>t</xsl:attribute><xsl:node-name/></SPAN> <xsl:apply-templates select="@*"/><SPAN class="m"> /></SPAN> |
|
288 |
</DIV></DIV> |
|
289 |
</xsl:template> |
|
290 |
|
|
291 |
<!-- Template for elements with comment, pi and/or cdata children --> |
|
292 |
<xsl:template match="*[node()]"> |
|
293 |
<DIV class="e"> |
|
294 |
<DIV class="c"><A href="#" onclick="return false" onfocus="h()" class="b">-</A> <SPAN class="m"><</SPAN><SPAN><xsl:attribute name="class"><xsl:if match="xsl:*">x</xsl:if>t</xsl:attribute><xsl:node-name/></SPAN><xsl:apply-templates select="@*"/> <SPAN class="m">></SPAN></DIV> |
|
295 |
<DIV><xsl:apply-templates/> |
|
296 |
<DIV><SPAN class="b"><xsl:entity-ref name="nbsp"/></SPAN> <SPAN class="m"></</SPAN><SPAN><xsl:attribute name="class"><xsl:if match="xsl:*">x</xsl:if>t</xsl:attribute><xsl:node-name/></SPAN><SPAN class="m">></SPAN></DIV> |
|
297 |
</DIV></DIV> |
|
298 |
</xsl:template> |
|
299 |
|
|
300 |
<!-- Template for elements with only text children --> |
|
301 |
<xsl:template match="*[textNode()$and$$not$(comment()$or$pi()$or$cdata())]"> |
|
302 |
<DIV class="e"><DIV STYLE="margin-left:1em;text-indent:-2em"> |
|
303 |
<SPAN class="b"><xsl:entity-ref name="nbsp"/></SPAN> <SPAN class="m"><</SPAN><SPAN><xsl:attribute name="class"><xsl:if match="xsl:*">x</xsl:if>t</xsl:attribute><xsl:node-name/></SPAN><xsl:apply-templates select="@*"/> |
|
304 |
<SPAN class="m">></SPAN><SPAN class="tx"><xsl:value-of/></SPAN><SPAN class="m"></</SPAN><SPAN><xsl:attribute name="class"><xsl:if match="xsl:*">x</xsl:if>t</xsl:attribute><xsl:node-name/></SPAN><SPAN class="m">></SPAN> |
|
305 |
</DIV></DIV> |
|
306 |
</xsl:template> |
|
307 |
|
|
308 |
<!-- Template for elements with element children --> |
|
309 |
<xsl:template match="*[*]"> |
|
310 |
<DIV class="e"> |
|
311 |
<DIV class="c" STYLE="margin-left:1em;text-indent:-2em"><A href="#" onclick="return false" onfocus="h()" class="b">-</A> <SPAN class="m"><</SPAN><SPAN><xsl:attribute name="class"><xsl:if match="xsl:*">x</xsl:if>t</xsl:attribute><xsl:node-name/></SPAN><xsl:apply-templates select="@*"/> <SPAN class="m">></SPAN></DIV> |
|
312 |
<DIV><xsl:apply-templates/> |
|
313 |
<DIV><SPAN class="b"><xsl:entity-ref name="nbsp"/></SPAN> <SPAN class="m"></</SPAN><SPAN><xsl:attribute name="class"><xsl:if match="xsl:*">x</xsl:if>t</xsl:attribute><xsl:node-name/></SPAN><SPAN class="m">></SPAN></DIV> |
|
314 |
</DIV></DIV> |
|
315 |
</xsl:template> |
|
316 |
|
|
317 | 417 |
</xsl:stylesheet> |
Also available in: Unified diff
New version of the IE5 stylesheet that is XSLT 1.0 compliant.