1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
|
3
|
<xsl:stylesheet version="2.0"
|
4
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
5
|
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
|
6
|
|
7
|
<xsl:output method="html" encoding="UTF-8" indent="yes" omit-xml-declaration="yes"/>
|
8
|
|
9
|
<xsl:template match="/record">
|
10
|
<p style="color:black; font-family:'Courier New', Courier, monospace; font-size:small">
|
11
|
<xsl:call-template name="xmlItem">
|
12
|
|
13
|
<xsl:with-param name="indent" select="string('')" />
|
14
|
</xsl:call-template>
|
15
|
</p>
|
16
|
</xsl:template>
|
17
|
|
18
|
|
19
|
<xsl:template name="xmlAttr">
|
20
|
<span style='color:red'><xsl:value-of select="concat(' ', local-name())"/></span>
|
21
|
<xsl:value-of select="concat('="', ., '"')"/>
|
22
|
|
23
|
</xsl:template>
|
24
|
|
25
|
<xsl:template name="xmlItem">
|
26
|
<xsl:param name="indent" />
|
27
|
|
28
|
<xsl:variable name="tag" select="local-name()" />
|
29
|
|
30
|
<xsl:variable name="newindent">
|
31
|
<xsl:value-of select="$indent" />
|
32
|
 
|
33
|
</xsl:variable>
|
34
|
|
35
|
<!-- <xsl:variable name="attribs"> -->
|
36
|
<!-- <xsl:for-each select="@*"> -->
|
37
|
<!-- <xsl:value-of select="concat(' ', local-name(), '="', ., '"')" /> -->
|
38
|
<!-- </xsl:for-each> -->
|
39
|
<!-- </xsl:variable> -->
|
40
|
<xsl:value-of select="$indent" />
|
41
|
|
42
|
<span style='color:blue'>
|
43
|
<xsl:value-of select="concat('<',$tag)" />
|
44
|
</span>
|
45
|
|
46
|
<!-- <xsl:value-of select="$attribs" /> -->
|
47
|
<xsl:for-each select="@*">
|
48
|
<xsl:call-template name="xmlAttr"/>
|
49
|
</xsl:for-each>
|
50
|
|
51
|
<span style='color:blue'>></span>
|
52
|
|
53
|
<xsl:value-of select="text()" />
|
54
|
|
55
|
<xsl:choose>
|
56
|
<xsl:when test="count(child::*) > 0">
|
57
|
<br />
|
58
|
<xsl:for-each select="child::*">
|
59
|
<xsl:call-template name="xmlItem">
|
60
|
<xsl:with-param name="indent" select="$newindent" />
|
61
|
</xsl:call-template>
|
62
|
<br />
|
63
|
</xsl:for-each>
|
64
|
<xsl:value-of select="$indent" />
|
65
|
</xsl:when>
|
66
|
<xsl:otherwise>
|
67
|
|
68
|
</xsl:otherwise>
|
69
|
</xsl:choose>
|
70
|
|
71
|
<span style='color:blue'>
|
72
|
<xsl:value-of select="concat('</',$tag,'>')" />
|
73
|
</span>
|
74
|
|
75
|
</xsl:template>
|
76
|
|
77
|
</xsl:stylesheet>
|