content/xml/document/resources/XMLPrettyPrint.xsl

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 <?xml version="1.0"?>
michael@0 2 <!-- This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 - License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
michael@0 5
michael@0 6 <!DOCTYPE overlay [
michael@0 7 <!ENTITY % prettyPrintDTD SYSTEM "chrome://global/locale/xml/prettyprint.dtd">
michael@0 8 %prettyPrintDTD;
michael@0 9 <!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
michael@0 10 %globalDTD;
michael@0 11 ]>
michael@0 12
michael@0 13 <xsl:stylesheet version="1.0"
michael@0 14 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
michael@0 15 xmlns="http://www.w3.org/1999/xhtml">
michael@0 16
michael@0 17 <xsl:output method="xml"/>
michael@0 18
michael@0 19 <xsl:template match="/">
michael@0 20 <link href="chrome://global/content/xml/XMLPrettyPrint.css" type="text/css" rel="stylesheet"/>
michael@0 21 <link title="Monospace" href="chrome://global/content/xml/XMLMonoPrint.css" type="text/css" rel="alternate stylesheet"/>
michael@0 22 <div id="header" dir="&locale.dir;">
michael@0 23 <p>
michael@0 24 &xml.nostylesheet;
michael@0 25 </p>
michael@0 26 </div>
michael@0 27 <xsl:apply-templates/>
michael@0 28 </xsl:template>
michael@0 29
michael@0 30 <xsl:template match="*">
michael@0 31 <div>
michael@0 32 <xsl:text>&lt;</xsl:text>
michael@0 33 <span class="start-tag"><xsl:value-of select="name(.)"/></span>
michael@0 34 <xsl:apply-templates select="@*"/>
michael@0 35 <xsl:text>/&gt;</xsl:text>
michael@0 36 </div>
michael@0 37 </xsl:template>
michael@0 38
michael@0 39 <xsl:template match="*[node()]">
michael@0 40 <div>
michael@0 41 <xsl:text>&lt;</xsl:text>
michael@0 42 <span class="start-tag"><xsl:value-of select="name(.)"/></span>
michael@0 43 <xsl:apply-templates select="@*"/>
michael@0 44 <xsl:text>&gt;</xsl:text>
michael@0 45
michael@0 46 <span class="text"><xsl:value-of select="."/></span>
michael@0 47
michael@0 48 <xsl:text>&lt;/</xsl:text>
michael@0 49 <span class="end-tag"><xsl:value-of select="name(.)"/></span>
michael@0 50 <xsl:text>&gt;</xsl:text>
michael@0 51 </div>
michael@0 52 </xsl:template>
michael@0 53
michael@0 54 <xsl:template match="*[* or processing-instruction() or comment() or string-length(.) &gt; 50]">
michael@0 55 <div class="expander-open">
michael@0 56 <xsl:call-template name="expander"/>
michael@0 57
michael@0 58 <xsl:text>&lt;</xsl:text>
michael@0 59 <span class="start-tag"><xsl:value-of select="name(.)"/></span>
michael@0 60 <xsl:apply-templates select="@*"/>
michael@0 61 <xsl:text>&gt;</xsl:text>
michael@0 62
michael@0 63 <div class="expander-content"><xsl:apply-templates/></div>
michael@0 64
michael@0 65 <xsl:text>&lt;/</xsl:text>
michael@0 66 <span class="end-tag"><xsl:value-of select="name(.)"/></span>
michael@0 67 <xsl:text>&gt;</xsl:text>
michael@0 68 </div>
michael@0 69 </xsl:template>
michael@0 70
michael@0 71 <xsl:template match="@*">
michael@0 72 <xsl:text> </xsl:text>
michael@0 73 <span class="attribute-name"><xsl:value-of select="name(.)"/></span>
michael@0 74 <xsl:text>=</xsl:text>
michael@0 75 <span class="attribute-value">"<xsl:value-of select="."/>"</span>
michael@0 76 </xsl:template>
michael@0 77
michael@0 78 <xsl:template match="text()">
michael@0 79 <xsl:if test="normalize-space(.)">
michael@0 80 <xsl:value-of select="."/>
michael@0 81 </xsl:if>
michael@0 82 </xsl:template>
michael@0 83
michael@0 84 <xsl:template match="processing-instruction()">
michael@0 85 <div class="pi">
michael@0 86 <xsl:text>&lt;?</xsl:text>
michael@0 87 <xsl:value-of select="name(.)"/>
michael@0 88 <xsl:text> </xsl:text>
michael@0 89 <xsl:value-of select="."/>
michael@0 90 <xsl:text>?&gt;</xsl:text>
michael@0 91 </div>
michael@0 92 </xsl:template>
michael@0 93
michael@0 94 <xsl:template match="processing-instruction()[string-length(.) &gt; 50]">
michael@0 95 <div class="expander-open">
michael@0 96 <xsl:call-template name="expander"/>
michael@0 97
michael@0 98 <span class="pi">
michael@0 99 <xsl:text> &lt;?</xsl:text>
michael@0 100 <xsl:value-of select="name(.)"/>
michael@0 101 </span>
michael@0 102 <div class="expander-content pi"><xsl:value-of select="."/></div>
michael@0 103 <span class="pi">
michael@0 104 <xsl:text>?&gt;</xsl:text>
michael@0 105 </span>
michael@0 106 </div>
michael@0 107 </xsl:template>
michael@0 108
michael@0 109 <xsl:template match="comment()">
michael@0 110 <div class="comment">
michael@0 111 <xsl:text>&lt;!--</xsl:text>
michael@0 112 <xsl:value-of select="."/>
michael@0 113 <xsl:text>--&gt;</xsl:text>
michael@0 114 </div>
michael@0 115 </xsl:template>
michael@0 116
michael@0 117 <xsl:template match="comment()[string-length(.) &gt; 50]">
michael@0 118 <div class="expander-open">
michael@0 119 <xsl:call-template name="expander"/>
michael@0 120
michael@0 121 <span class="comment">
michael@0 122 <xsl:text>&lt;!--</xsl:text>
michael@0 123 </span>
michael@0 124 <div class="expander-content comment">
michael@0 125 <xsl:value-of select="."/>
michael@0 126 </div>
michael@0 127 <span class="comment">
michael@0 128 <xsl:text>--&gt;</xsl:text>
michael@0 129 </span>
michael@0 130 </div>
michael@0 131 </xsl:template>
michael@0 132
michael@0 133 <xsl:template name="expander">
michael@0 134 <div class="expander">&#x2212;</div>
michael@0 135 </xsl:template>
michael@0 136
michael@0 137 </xsl:stylesheet>

mercurial