Project

General

Profile

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="/">
10
		<xsl:for-each select="//*[local-name()='record']">
11
			<div
12
					style="color:black; font-family:'Courier New', Courier, monospace; font-size:small">
13
				<xsl:call-template name="xmlItem">
14
					<xsl:with-param name="indent" select="string('')" />
15
				</xsl:call-template>
16
			</div>
17
		</xsl:for-each>
18
	</xsl:template>
19

    
20
	<xsl:template name="xmlAttr">
21
		<span style='color:red'><xsl:value-of select="concat(' ', local-name())"/></span>
22
		<xsl:value-of select="concat('=&quot;', ., '&quot;')"/>
23
	</xsl:template>
24

    
25
	<xsl:template name="xmlItem">
26
		<xsl:param name="indent" />
27
		<xsl:variable name="tag" select="local-name()" />
28
		<xsl:variable name="newindent"><xsl:value-of select="$indent" />&#160;&#160;&#160;&#160;</xsl:variable>
29

    
30
		<xsl:if test="string-length($tag)">
31
			<br/><xsl:value-of select="$indent" /><span style='color:blue'><xsl:value-of select="concat('&lt;',$tag)" /></span>
32
			<xsl:for-each select="@*">
33
				<xsl:call-template name="xmlAttr"/>
34
			</xsl:for-each>
35

    
36
			<xsl:choose>
37
				<xsl:when test="count(child::*) = 0 and count(child::text()) = 1">
38
					<span style='color:blue'>&gt;</span>
39
					<xsl:value-of select="normalize-space(.)" />
40
					<span style='color:blue'><xsl:value-of select="concat('&lt;/',$tag,'&gt;')" /></span>
41
				</xsl:when>
42
				<xsl:when test="count(child::* | child::text()) &gt; 0">
43
					<span style='color:blue'>&gt;</span>
44
					<xsl:for-each select="child::* | child::text()">
45
						<xsl:choose>
46
							<xsl:when test="self::text() and string-length(normalize-space(.)) &gt; 0">
47
								<xsl:value-of select="normalize-space(.)" />
48
							</xsl:when>
49
							<xsl:otherwise>
50
								<xsl:call-template name="xmlItem">
51
									<xsl:with-param name="indent" select="$newindent" />
52
								</xsl:call-template>
53
							</xsl:otherwise>
54
						</xsl:choose>
55
					</xsl:for-each>
56
					<br /><xsl:value-of select="$indent" /><span style='color:blue'><xsl:value-of select="concat('&lt;/',$tag,'&gt;')" /></span>
57
				</xsl:when>
58
				<xsl:otherwise>
59
					<span style='color:blue'>&#160;/&gt;</span>
60
				</xsl:otherwise>
61
			</xsl:choose>
62
		</xsl:if>
63
	</xsl:template>
64

    
65
</xsl:stylesheet>
    (1-1/1)