My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?xml version='1.0' ?>
<xsl:stylesheet
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
xmlns="http://www.w3.org/1999/xhtml"
version='1.0'
>
<!--

This stylesheet transform xml to html

-->
<xsl:output method="html"
indent="yes"
omit-xml-declaration="yes"
/>



<xsl:template match="/">
<div style="font-family:monospace;white-space:pre; background-color:rgb(230,230,230);border: 1px solid black;width:100%;height:300px;overflow:auto;">
<xsl:apply-templates/>
</div>
</xsl:template>

<xsl:template match="text()"><xsl:choose><xsl:when test="string-length(normalize-space(.))&gt;0"><span style="color:gray;"><xsl:value-of select="."/></span></xsl:when><xsl:otherwise><xsl:value-of select="."/></xsl:otherwise></xsl:choose></xsl:template>


<xsl:template match="@*"><xsl:text> </xsl:text><xsl:value-of select="name()"/>=&quot;<span style="color:gray;"><xsl:choose><xsl:when test="starts-with (.,&apos;http://&apos;)"><xsl:element name="a"><xsl:attribute name="href"><xsl:value-of select="."/></xsl:attribute><xsl:value-of select="."/></xsl:element></xsl:when><xsl:otherwise><xsl:value-of select="."/></xsl:otherwise></xsl:choose></span>&quot;</xsl:template>

<xsl:template match="node()" name="element"><xsl:choose>
<xsl:when test="count(child::node()) != 0"><span>&lt;<xsl:value-of select="name()"/><xsl:apply-templates select="@*"/>&gt;</span><xsl:apply-templates/><span>&lt;/<xsl:value-of select="name()"/>&gt;</span></xsl:when>
<xsl:otherwise><span>&lt;<xsl:value-of select="name()"/><xsl:apply-templates select="@*"/>/&gt;</span></xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="comment()"><span style="color:green;"
>&lt;!-- <xsl:value-of select="."/> --&gt;</span
></xsl:template>

<xsl:template match="processing-instruction()"><span style="color:blue;"
>&lt;?<xsl:value-of select="name()"/><xsl:text> </xsl:text> <xsl:value-of select="."/> ?&gt;</span></xsl:template>





</xsl:stylesheet>

Change log

r452 by plindenbaum on Feb 15, 2010   Diff
cont
Go to: 
Project members, sign in to write a code review

Older revisions

r277 by plindenbaum on May 20, 2009   Diff
cont
r248 by plindenbaum on Apr 3, 2009   Diff
cont
r239 by plindenbaum on Mar 7, 2009   Diff
cont
All revisions of this file

File info

Size: 1936 bytes, 47 lines
Powered by Google Project Hosting