blob: a25a14d2a4a2e53800fc88f997d877cba5bb4ec8 (
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
<?xml version="1.0" encoding="UTF-8"?>
<!--
File : testdoc.xsl
Author: Keith Isdale <[email protected]>
Description: stylesheet for testing
Copyright Reserved Under GPL
-->
<!-- This file does not require translation -->
<!-- NO TRANSLATION -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:import href="test_import.xsl"/>
<xsl:include href="test_include_top.xsl"/>
<xsl:strip-space elements="text()"/>
<xsl:decimal-format name="test" decimal-separator="."/>
<xsl:output method="text"/>
<xsl:variable name="globalvariable" select="'foo'"/>
<xsl:template match="/">
<xsl:call-template name="test_set_variable">
<xsl:with-param name="item" select="'1234'"/>
</xsl:call-template>
<xsl:variable name="localvariable" select="'bar'"/>
<xsl:text>Global variable tqcontains </xsl:text><xsl:value-of select="$globalvariable"/><xsl:text>
</xsl:text>
<xsl:text>Local variable tqcontains </xsl:text><xsl:value-of select="$localvariable"/><xsl:text>
</xsl:text>
<!-- test import of xsl file -->
<xsl:call-template name="import_top"/>
<!-- Basic xsl:apply-templates, xsl:call-template usage -->
<!-- Test basic usage of xsl:apply-templates -->
<xsl:apply-templates select="//result/data"/>
<!-- Test basic usage of xsl:call-template -->
<xsl:call-template name="call-template1"/>
<!-- Test xsl:apply-templates with parameter value.
Test the ability to step into a xsl:with-param child -->
<xsl:apply-templates select="//result/data">
<xsl:with-param name="item">
<item/>
</xsl:with-param>
</xsl:apply-templates>
<!-- Test xsl:call-template with parameter value
Test the ability to step into a xsl:with-param child -->
<xsl:call-template name="call-template2">
<xsl:with-param name="item">
<item />
</xsl:with-param>
</xsl:call-template>
<!-- Test ability to step into xsl:param from xsl:apply-templates -->
<xsl:apply-templates select="//result/extra" />
<!-- Test ability to step into xsl:param from xsl:call-template -->
<xsl:call-template name="call-template3" />
<!-- Test ability to step into xsl:sort from xsl:apply-templates -->
<xsl:apply-templates select="//result/data">
<xsl:sort select="."/>
<xsl:text>
</xsl:text>
</xsl:apply-templates>
<xsl:apply-imports/> <!-- useless but test that we can step to it -->
<xsl:apply-templates select="//result/data" mode="verbose" />
</xsl:template>
<xsl:template match="result">
<xsl:param name="item" select="'default'"/>
<!-- ignore node content -->
</xsl:template>
<xsl:template match="data">
<!-- ignore node content -->
</xsl:template>
<xsl:template match="data" mode="verbose">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="extra">
<xsl:param name="item">
<item/>
</xsl:param>
<!-- ignore node content -->
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template name="call-template1">
<xsl:number value="position()" format="1."/>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template name="call-template2">
<!-- ignore any param provided -->
<!-- test message -->
<xsl:message terminate="no">Message here</xsl:message>
<xsl:processing-instruction name="pitest">
pi text
</xsl:processing-instruction>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template name="call-template3">
<xsl:param name="item">
<item/>
</xsl:param>
<!-- test comments -->
<xsl:comment>A text comment.</xsl:comment>
<!-- test copy and copy-of -->
<xsl:copy>copy text</xsl:copy>
<xsl:copy-of select="'copy-of Text'"/>
<xsl:text>
</xsl:text>
</xsl:template>
<xsl:template name="test_set_variable">
<xsl:param name="item" select="'default-value'"/>
<xsl:value-of select="$item"/>
<xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
|