2 <!-- ***** BEGIN LICENSE BLOCK *****
3 - Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 - The contents of this file are subject to the Mozilla Public License Version
6 - 1.1 (the "License"); you may not use this file except in compliance with
7 - the License. You may obtain a copy of the License at
8 - http://www.mozilla.org/MPL/
10 - Software distributed under the License is distributed on an "AS IS" basis,
11 - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 - for the specific language governing rights and limitations under the
15 - The Original Code is mozilla.org code.
17 - The Initial Developer of the Original Code is
18 - Netscape Communications Corporation.
19 - Portions created by the Initial Developer are Copyright (C) 2002
20 - the Initial Developer. All Rights Reserved.
23 - Jonas Sicking <sicking@bigfoot.com> (Original author)
25 - Alternatively, the contents of this file may be used under the terms of
26 - either the GNU General Public License Version 2 or later (the "GPL"), or
27 - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 - in which case the provisions of the GPL or the LGPL are applicable instead
29 - of those above. If you wish to allow use of your version of this file only
30 - under the terms of either the GPL or the LGPL, and not to allow others to
31 - use your version of this file under the terms of the MPL, indicate your
32 - decision by deleting the provisions above and replace them with the notice
33 - and other provisions required by the LGPL or the GPL. If you do not delete
34 - the provisions above, a recipient may use your version of this file under
35 - the terms of any one of the MPL, the GPL or the LGPL.
37 - ***** END LICENSE BLOCK ***** -->
39 <!DOCTYPE overlay SYSTEM
"chrome://global/locale/xml/prettyprint.dtd">
41 <xsl:stylesheet version=
"1.0"
42 xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform"
43 xmlns=
"http://www.w3.org/1999/xhtml">
45 <xsl:output method=
"xml"/>
47 <xsl:template match=
"/">
48 <link href=
"chrome://global/content/xml/XMLPrettyPrint.css" type=
"text/css" rel=
"stylesheet"/>
49 <link title=
"Monospace" href=
"chrome://global/content/xml/XMLMonoPrint.css" type=
"text/css" rel=
"alternate stylesheet"/>
55 <xsl:apply-templates/>
58 <xsl:template match=
"*">
60 <xsl:text><</xsl:text>
61 <span class=
"start-tag"><xsl:value-of select=
"name(.)"/></span>
62 <xsl:apply-templates select=
"@*"/>
63 <xsl:text>/
></xsl:text>
67 <xsl:template match=
"*[node()]">
69 <xsl:text><</xsl:text>
70 <span class=
"start-tag"><xsl:value-of select=
"name(.)"/></span>
71 <xsl:apply-templates select=
"@*"/>
72 <xsl:text>></xsl:text>
74 <span class=
"text"><xsl:value-of select=
"."/></span>
76 <xsl:text></
</xsl:text>
77 <span class=
"end-tag"><xsl:value-of select=
"name(.)"/></span>
78 <xsl:text>></xsl:text>
82 <xsl:template match=
"*[* or processing-instruction() or comment() or string-length(.) > 50]">
83 <div class=
"expander-open">
84 <xsl:call-template name=
"expander"/>
86 <xsl:text><</xsl:text>
87 <span class=
"start-tag"><xsl:value-of select=
"name(.)"/></span>
88 <xsl:apply-templates select=
"@*"/>
89 <xsl:text>></xsl:text>
91 <div class=
"expander-content"><xsl:apply-templates/></div>
93 <xsl:text></
</xsl:text>
94 <span class=
"end-tag"><xsl:value-of select=
"name(.)"/></span>
95 <xsl:text>></xsl:text>
99 <xsl:template match=
"@*">
100 <xsl:text> </xsl:text>
101 <span class=
"attribute-name"><xsl:value-of select=
"name(.)"/></span>
102 <xsl:text>=
</xsl:text>
103 <span class=
"attribute-value">"<xsl:value-of select=".
"/>"</span>
106 <xsl:template match=
"text()">
107 <xsl:if test=
"normalize-space(.)">
108 <xsl:value-of select=
"."/>
112 <xsl:template match=
"processing-instruction()">
114 <xsl:text><?
</xsl:text>
115 <xsl:value-of select=
"name(.)"/>
116 <xsl:text> </xsl:text>
117 <xsl:value-of select=
"."/>
118 <xsl:text>?
></xsl:text>
122 <xsl:template match=
"processing-instruction()[string-length(.) > 50]">
123 <div class=
"expander-open">
124 <xsl:call-template name=
"expander"/>
127 <xsl:text> <?
</xsl:text>
128 <xsl:value-of select=
"name(.)"/>
130 <div class=
"expander-content pi"><xsl:value-of select=
"."/></div>
132 <xsl:text>?
></xsl:text>
137 <xsl:template match=
"comment()">
138 <div class=
"comment">
139 <xsl:text><!--
</xsl:text>
140 <xsl:value-of select=
"."/>
141 <xsl:text>--
></xsl:text>
145 <xsl:template match=
"comment()[string-length(.) > 50]">
146 <div class=
"expander-open">
147 <xsl:call-template name=
"expander"/>
149 <span class=
"comment">
150 <xsl:text><!--
</xsl:text>
152 <div class=
"expander-content comment">
153 <xsl:value-of select=
"."/>
155 <span class=
"comment">
156 <xsl:text>--
></xsl:text>
161 <xsl:template name=
"expander">
162 <div class=
"expander">−</div>