Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / content / xml / document / resources / XMLPrettyPrint.xsl
blob831144bf198c4f93b94c3285188948d5037f451f
1 <?xml version="1.0"?>
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
13 - License.
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.
22 - Contributor(s):
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"/>
50 <div id="header">
51 <p>
52 &xml.nostylesheet;
53 </p>
54 </div>
55 <xsl:apply-templates/>
56 </xsl:template>
58 <xsl:template match="*">
59 <div>
60 <xsl:text>&lt;</xsl:text>
61 <span class="start-tag"><xsl:value-of select="name(.)"/></span>
62 <xsl:apply-templates select="@*"/>
63 <xsl:text>/&gt;</xsl:text>
64 </div>
65 </xsl:template>
67 <xsl:template match="*[node()]">
68 <div>
69 <xsl:text>&lt;</xsl:text>
70 <span class="start-tag"><xsl:value-of select="name(.)"/></span>
71 <xsl:apply-templates select="@*"/>
72 <xsl:text>&gt;</xsl:text>
74 <span class="text"><xsl:value-of select="."/></span>
76 <xsl:text>&lt;/</xsl:text>
77 <span class="end-tag"><xsl:value-of select="name(.)"/></span>
78 <xsl:text>&gt;</xsl:text>
79 </div>
80 </xsl:template>
82 <xsl:template match="*[* or processing-instruction() or comment() or string-length(.) &gt; 50]">
83 <div class="expander-open">
84 <xsl:call-template name="expander"/>
86 <xsl:text>&lt;</xsl:text>
87 <span class="start-tag"><xsl:value-of select="name(.)"/></span>
88 <xsl:apply-templates select="@*"/>
89 <xsl:text>&gt;</xsl:text>
91 <div class="expander-content"><xsl:apply-templates/></div>
93 <xsl:text>&lt;/</xsl:text>
94 <span class="end-tag"><xsl:value-of select="name(.)"/></span>
95 <xsl:text>&gt;</xsl:text>
96 </div>
97 </xsl:template>
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>
104 </xsl:template>
106 <xsl:template match="text()">
107 <xsl:if test="normalize-space(.)">
108 <xsl:value-of select="."/>
109 </xsl:if>
110 </xsl:template>
112 <xsl:template match="processing-instruction()">
113 <div class="pi">
114 <xsl:text>&lt;?</xsl:text>
115 <xsl:value-of select="name(.)"/>
116 <xsl:text> </xsl:text>
117 <xsl:value-of select="."/>
118 <xsl:text>?&gt;</xsl:text>
119 </div>
120 </xsl:template>
122 <xsl:template match="processing-instruction()[string-length(.) &gt; 50]">
123 <div class="expander-open">
124 <xsl:call-template name="expander"/>
126 <span class="pi">
127 <xsl:text> &lt;?</xsl:text>
128 <xsl:value-of select="name(.)"/>
129 </span>
130 <div class="expander-content pi"><xsl:value-of select="."/></div>
131 <span class="pi">
132 <xsl:text>?&gt;</xsl:text>
133 </span>
134 </div>
135 </xsl:template>
137 <xsl:template match="comment()">
138 <div class="comment">
139 <xsl:text>&lt;!--</xsl:text>
140 <xsl:value-of select="."/>
141 <xsl:text>--&gt;</xsl:text>
142 </div>
143 </xsl:template>
145 <xsl:template match="comment()[string-length(.) &gt; 50]">
146 <div class="expander-open">
147 <xsl:call-template name="expander"/>
149 <span class="comment">
150 <xsl:text>&lt;!--</xsl:text>
151 </span>
152 <div class="expander-content comment">
153 <xsl:value-of select="."/>
154 </div>
155 <span class="comment">
156 <xsl:text>--&gt;</xsl:text>
157 </span>
158 </div>
159 </xsl:template>
161 <xsl:template name="expander">
162 <div class="expander">&#x2212;</div>
163 </xsl:template>
165 </xsl:stylesheet>