- Timestamp:
- 03/26/08 21:29:58 (5 years ago)
- Files:
-
- 1 modified
-
lang/xslt/misc/xml.xsl (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/xslt/misc/xml.xsl
r8401 r8403 2 2 <?xml-stylesheet type="text/xsl" href="xml.xsl"?> 3 3 <xsl:stylesheet version="1.0" 4 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 5 xmlns:my="http://coderepos.org/" 4 6 xmlns="http://www.w3.org/1999/xhtml" 5 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 7 xmlns:xhtml1="http://www.w3.org/1999/xhtml" 8 xmlns:xhtml2="http://www.w3.org/2002/06/xhtml2/" 6 9 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 7 10 xmlns:cc="http://web.resource.org/cc/" 8 xmlns:my="http://coderepos.org/" 9 exclude-result-prefixes="rdf cc my" 11 exclude-result-prefixes="my rdf cc xhtml1 xhtml2" 10 12 xml:lang="ja"> 11 13 … … 22 24 <xsl:param name="shortlen" select="20"/> 23 25 24 <xsl:strip-space elements="*" /> 25 26 <xsl:template name="my:cho45.css"> 27 <xsl:text><![CDATA[ 28 * { 29 margin: 0; 30 padding: 0; 31 text-decoration: none; 32 font-size: 100%; 33 font-weight: normal; 34 font-style: normal; 35 background: transparent; 36 border: none; 37 } 38 39 body { 40 font-family: "Verdana", "Helvetica", sans-serif; 41 background: #000; 42 color: #fff; 43 padding: 0; 44 margin: 0; 45 line-height: 1.4; 46 } 47 48 h1 { 49 font-size: 100%; 50 background: #c80055; 51 margin: 0; 52 padding: 0.5em; 53 } 54 55 p { 56 margin: 0; 57 } 58 59 #tree { 60 padding: 2em 1em; 61 margin: 0; 62 border-style: solid; 63 border-width: 0 0 0 2em; 64 border-color: #1b261d; 65 } 66 67 #info { 68 background: #c80055; 69 margin: 0 0 0 0; 70 padding: 1em; 71 } 72 73 .paren { 74 color: #72655b; 75 } 76 77 .content { 78 margin: 0 0 0 2em; 79 } 80 81 .ename { 82 color: #c80055; 83 } 84 85 .attrn { 86 color: #ab5a39; 87 } 88 89 .attrv { 90 color: #4e6443; 91 } 92 93 .attrv a { 94 color: #4e6443; 95 text-decoration: none; 96 border-bottom: 1px dotted; 97 } 98 99 .attrv a:hover { 100 color: #4e6443; 101 text-decoration: none; 102 border-bottom: none; 103 } 104 105 .comment { 106 color: #999; 107 } 108 109 .pi { 110 color: #993; 111 } 112 113 .text { 114 color: #70645a; 115 } 116 117 .less { 118 } 119 .less a { 120 } 121 ]]></xsl:text> 122 </xsl:template> 26 <xsl:strip-space elements="*"/> 27 <xsl:preserve-space elements="xsl:text xhtml2:blockcode xhtml1:pre xhtml2:pre xhtml1:style xhtml2:style xhtml1:textarea"/> 123 28 124 29 <xsl:template match="/"> … … 149 54 <p> 150 55 <strong><xsl:value-of select="count(//node()) + count(//@node())"/></strong> 151 <xsl:text> nodes . (</xsl:text>152 <strong><xsl:value-of select="count(//*)"/></strong><xsl:text> elements .</xsl:text>153 <strong><xsl:value-of select="count(//@node())"/></strong><xsl:text> attributes .</xsl:text>154 <strong><xsl:value-of select="count(//text())"/></strong><xsl:text> texts .</xsl:text>155 <strong><xsl:value-of select="count(//comment())"/></strong><xsl:text> comments .</xsl:text>156 <strong><xsl:value-of select="count(//processing-instruction())"/></strong><xsl:text> processing-instructions .)</xsl:text>56 <xsl:text> nodes (</xsl:text> 57 <strong><xsl:value-of select="count(//*)"/></strong><xsl:text> elements, </xsl:text> 58 <strong><xsl:value-of select="count(//@node())"/></strong><xsl:text> attributes, </xsl:text> 59 <strong><xsl:value-of select="count(//text())"/></strong><xsl:text> texts, </xsl:text> 60 <strong><xsl:value-of select="count(//comment())"/></strong><xsl:text> comments, </xsl:text> 61 <strong><xsl:value-of select="count(//processing-instruction())"/></strong><xsl:text> processing-instructions)</xsl:text> 157 62 </p> 158 63 <p class="less"> 159 xsl:version: <xsl:value-of select="format-number(system-property('xsl:version'), '0.0')"/>, 160 xsl:vendor: 161 <xsl:value-of select="system-property('xsl:vendor')"/> - 64 <xsl:text>xsl:version: </xsl:text> 65 <xsl:value-of select="format-number(system-property('xsl:version'), '0.0')"/> 66 <xsl:text>, xsl:vendor: </xsl:text> 67 <xsl:value-of select="system-property('xsl:vendor')"/> 68 <xsl:text> - </xsl:text> 162 69 <xsl:value-of select="system-property('xsl:vendor-url')"/> 163 70 </p> … … 173 80 <xsl:choose> 174 81 <xsl:when test=". = '' and count(*) = 0"> 175 <span class="paren"><</span><span class="ename"><xsl:value-of select="name()" /></span> 82 <span class="paren"><</span> 83 <span class="ename"><xsl:value-of select="name()"/></span> 176 84 <xsl:apply-templates select="@*" mode="my:tree.xhtml"/> 177 85 <span class="paren">/></span> … … 179 87 <xsl:otherwise> 180 88 <span class="paren"><</span> 181 <span class="ename"><xsl:value-of select="name()" /></span>89 <span class="ename"><xsl:value-of select="name()"/></span> 182 90 <xsl:apply-templates select="@*" mode="my:tree.xhtml"/> 183 91 <span class="paren">></span> … … 192 100 </xsl:otherwise> 193 101 </xsl:choose> 194 <span class="paren"><</span><span class="ename"><xsl:text>/</xsl:text><xsl:value-of select="name()" /></span><span class="paren">></span> 102 <span class="paren"><</span> 103 <span class="ename"> 104 <xsl:text>/</xsl:text> 105 <xsl:value-of select="name()"/> 106 </span> 107 <span class="paren">></span> 195 108 </xsl:otherwise> 196 109 </xsl:choose> … … 201 114 <xsl:text> </xsl:text> 202 115 <span class="attrn"> 203 <xsl:value-of select="name()" />116 <xsl:value-of select="name()"/> 204 117 <xsl:text>=</xsl:text> 205 118 </span> … … 239 152 <div class="element pi"> 240 153 <xsl:text><?</xsl:text> 241 <xsl:value-of select="name()" />154 <xsl:value-of select="name()"/> 242 155 <xsl:text> </xsl:text> 243 156 <xsl:value-of select="."/> … … 256 169 <!-- & > < 変換 --> 257 170 <xsl:template name="my:entity"> 258 <xsl:param name="string" />171 <xsl:param name="string"/> 259 172 <xsl:choose> 260 173 <xsl:when test="contains($string, '&')"> 261 174 <xsl:call-template name="my:entity2"> 262 <xsl:with-param name="string" select="substring-before($string, '&')" />175 <xsl:with-param name="string" select="substring-before($string, '&')"/> 263 176 </xsl:call-template> 264 177 <xsl:text>&amp;</xsl:text> 265 178 <xsl:call-template name="my:entity"> 266 <xsl:with-param name="string" select="substring-after($string, '&')" />179 <xsl:with-param name="string" select="substring-after($string, '&')"/> 267 180 </xsl:call-template> 268 181 </xsl:when> 269 182 <xsl:otherwise> 270 183 <xsl:call-template name="my:entity2"> 271 <xsl:with-param name="string" select="$string" />184 <xsl:with-param name="string" select="$string"/> 272 185 </xsl:call-template> 273 186 </xsl:otherwise> … … 276 189 277 190 <xsl:template name="my:entity2"> 278 <xsl:param name="string" />191 <xsl:param name="string"/> 279 192 <xsl:choose> 280 193 <xsl:when test="contains($string, '<') or contains($string, '>')"> 281 194 <xsl:choose> 282 195 <xsl:when test="contains($string, '<')"> 283 <xsl:if test="contains($string, '<')"> 284 <xsl:variable name="nstr"><xsl:value-of select="substring-before($string, '<')"/><xsl:text>&lt;</xsl:text><xsl:value-of select="substring-after($string, '<')"/></xsl:variable> 285 <xsl:call-template name="my:entity2"> 286 <xsl:with-param name="string" select="$nstr"/> 287 </xsl:call-template> 288 </xsl:if> 196 <xsl:variable name="nstr"> 197 <xsl:value-of select="substring-before($string, '<')"/> 198 <xsl:text>&lt;</xsl:text> 199 <xsl:value-of select="substring-after($string, '<')"/> 200 </xsl:variable> 201 <xsl:call-template name="my:entity2"> 202 <xsl:with-param name="string" select="$nstr"/> 203 </xsl:call-template> 289 204 </xsl:when> 290 205 <xsl:when test="contains($string, '>')"> 291 <xsl:if test="contains($string, '>')"> 292 <xsl:variable name="nstr"><xsl:value-of select="substring-before($string, '>')"/><xsl:text>&gt;</xsl:text><xsl:value-of select="substring-after($string, '>')"/></xsl:variable> 293 <xsl:call-template name="my:entity2"> 294 <xsl:with-param name="string" select="$nstr"/> 295 </xsl:call-template> 296 </xsl:if> 206 <xsl:variable name="nstr"> 207 <xsl:value-of select="substring-before($string, '>')"/> 208 <xsl:text>&gt;</xsl:text> 209 <xsl:value-of select="substring-after($string, '>')"/> 210 </xsl:variable> 211 <xsl:call-template name="my:entity2"> 212 <xsl:with-param name="string" select="$nstr"/> 213 </xsl:call-template> 297 214 </xsl:when> 298 215 </xsl:choose> … … 304 221 </xsl:template> 305 222 223 <xsl:template name="my:cho45.css"> 224 <xsl:text><![CDATA[ 225 * { 226 margin: 0; 227 padding: 0; 228 text-decoration: none; 229 font-size: 100%; 230 font-weight: normal; 231 font-style: normal; 232 background: transparent; 233 border: none; 234 } 235 236 body { 237 font-family: "Verdana", "Helvetica", sans-serif; 238 background: #000; 239 color: #fff; 240 padding: 0; 241 margin: 0; 242 line-height: 1.4; 243 } 244 245 h1 { 246 font-size: 100%; 247 background: #c80055; 248 margin: 0; 249 padding: 0.5em; 250 } 251 252 p { 253 margin: 0; 254 } 255 256 #tree { 257 padding: 2em 1em; 258 margin: 0; 259 border-style: solid; 260 border-width: 0 0 0 2em; 261 border-color: #1b261d; 262 } 263 264 #info { 265 background: #c80055; 266 margin: 0 0 0 0; 267 padding: 1em; 268 } 269 270 .paren { 271 color: #72655b; 272 } 273 274 .content { 275 margin: 0 0 0 2em; 276 } 277 278 .ename { 279 color: #c80055; 280 } 281 282 .attrn { 283 color: #ab5a39; 284 } 285 286 .attrv { 287 color: #4e6443; 288 } 289 290 .attrv a { 291 color: #4e6443; 292 text-decoration: none; 293 border-bottom: 1px dotted; 294 } 295 296 .attrv a:hover { 297 color: #4e6443; 298 text-decoration: none; 299 border-bottom: none; 300 } 301 302 .comment { 303 color: #999; 304 } 305 306 .pi { 307 color: #993; 308 } 309 310 .text { 311 color: #70645a; 312 } 313 314 .less { 315 } 316 .less a { 317 } 318 ]]></xsl:text> 319 </xsl:template> 320 306 321 </xsl:stylesheet>
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)