blob: 2406987d0b68fe538b3f6a9c7dd8d59aee911881 (
plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:param name="contextid">n1</xsl:param>
<xsl:variable name="contextnode" select="id($contextid)"/>
<xsl:template match="/">
<html>
<head>
<title>
<xsl:value-of select="$contextnode/title"/>
</title>
</head>
<body>
<h2>
<xsl:value-of select="$contextnode/title"/>
</h2>
<xsl:apply-templates select="$contextnode"/>
<table border="1" cellpadding="6" cellspacing="0">
<tr>
<th>Type</th>
<th>@xml:id</th>
<th>@name</th>
<th>Parent Type</th>
<th>Parent @name</th>
</tr>
<tr>
<td>
<xsl:value-of select="name($contextnode)"/>
</td>
<td>
<xsl:value-of select="$contextnode/@xml:id"/>
</td>
<td>
<xsl:value-of select="$contextnode/@name"/>
</td>
<td>
<xsl:value-of select="name($contextnode/..)"/>
</td>
<td>
<xsl:value-of select="$contextnode/../@name"/>
</td>
</tr>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="folder">
<p>
<em>Folders are special, they contain things.</em>
</p>
<xsl:if test="*[@xml:id]">
<h2>Folder Contents</h2>
<ul>
<xsl:for-each select="*[@xml:id]">
<li>
<a href="{../@name}/{@name}">
<xsl:value-of select="title"/>
</a>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:template>
<xsl:template match="document">
<p>
<em>Documents contain text.</em>
</p>
<xsl:copy-of select="body/*"/>
</xsl:template>
</xsl:stylesheet>
|