scxml 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +0 -0
- data/lib/scxml.rb +86 -0
- data/lib/scxml/document.rb +165 -0
- data/lib/scxml/element.rb +219 -0
- data/lib/scxml/xpath.rb +142 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate01.out +2 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate02.out +2 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate03.out +2 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate04.out +2 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate12.out +4 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate13.out +2 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate41.out +2 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate42.out +2 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate45.out +2 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate51.out +2 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate52.out +2 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate56.out +2 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate57.out +5 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate58.out +11 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select01.out +2 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select02.out +4 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select03.out +2 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select04.out +14 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select12.out +2 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select13.out +13 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select41.out +5 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select42.out +5 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select45.out +5 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select51.out +5 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select52.out +3 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select56.out +7 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select57.out +7 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select58.out +5 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select60.out +5 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select62.out +2 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select63.out +2 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select76.out +2 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select81.out +10 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select82.out +2 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select83.out +7 -0
- data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select84.out +8 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate01.txt +8 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate01.xml +7 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate01.xsl +18 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate02.txt +8 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate02.xml +7 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate02.xsl +18 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate04.txt +8 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate04.xml +7 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate04.xsl +18 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate07.txt +9 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate07.xml +7 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate07.xsl +20 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate08.txt +9 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate08.xml +7 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate08.xsl +20 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate10.txt +8 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate10.xml +7 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate10.xsl +20 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate14.txt +9 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate14.xml +9 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate14.xsl +20 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate15.txt +9 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate15.xml +9 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate15.xsl +20 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate16.txt +9 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate16.xml +9 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate16.xsl +20 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate17.txt +9 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate17.xml +11 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate17.xsl +20 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate36.txt +8 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate36.xml +7 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate36.xsl +20 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate48.txt +8 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate48.xml +21 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate48.xsl +22 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate49.txt +8 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate49.xml +21 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate49.xsl +22 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate50.txt +8 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate50.xml +21 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate50.xsl +22 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate51.txt +8 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate51.xml +21 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate51.xsl +22 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate52.txt +8 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate52.xml +21 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate52.xsl +22 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate53.txt +8 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate53.xml +21 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate53.xsl +22 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate54.txt +7 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate54.xml +21 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate54.xsl +21 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate55.txt +8 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate55.xml +21 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate55.xsl +22 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate56.txt +8 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate56.xml +21 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/predicate56.xsl +22 -0
- data/test/scxml/Xalan_Conformance_Tests/predicate/prepare.rb +34 -0
- data/test/scxml/Xalan_Conformance_Tests/select/prepare.rb +34 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select01.txt +7 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select01.xml +9 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select01.xsl +19 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select02.txt +7 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select02.xml +4 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select02.xsl +17 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select03.txt +8 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select03.xml +13 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select03.xsl +19 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select04.txt +12 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select04.xml +12 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select04.xsl +35 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select12.txt +7 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select12.xml +9 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select12.xsl +19 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select13.txt +13 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select13.xml +18 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select13.xsl +33 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select41.txt +7 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select41.xml +9 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select41.xsl +23 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select42.txt +8 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select42.xml +9 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select42.xsl +26 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select45.txt +7 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select45.xml +24 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select45.xsl +25 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select51.txt +7 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select51.xml +24 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select51.xsl +25 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select52.txt +6 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select52.xml +6 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select52.xsl +23 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select56.txt +7 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select56.xml +29 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select56.xsl +25 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select57.txt +7 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select57.xml +29 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select57.xsl +25 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select58.txt +7 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select58.xml +17 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select58.xsl +25 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select60.txt +6 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select60.xml +9 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select60.xsl +25 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select62.txt +6 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select62.xml +5 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select62.xsl +22 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select63.txt +7 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select63.xml +10 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select63.xsl +19 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select76.txt +7 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select76.xml +6 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select76.xsl +17 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select81.txt +9 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select81.xml +6 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select81.xsl +24 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select82.txt +9 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select82.xml +5 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select82.xsl +28 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select83.txt +10 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select83.xml +10 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select83.xsl +32 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select84.txt +11 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select84.xml +10 -0
- data/test/scxml/Xalan_Conformance_Tests/select/select84.xsl +33 -0
- data/test/scxml/document_test.rb +231 -0
- data/test/scxml/element_test.rb +552 -0
- data/test/scxml_test_helper.rb +73 -0
- data/test/scxml_test_suite.rb +2 -0
- metadata +241 -0
data/lib/scxml/xpath.rb
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
|
2
|
+
module SCXML
|
3
|
+
module XPath
|
4
|
+
attr_reader :string, :content_range
|
5
|
+
|
6
|
+
def content
|
7
|
+
self.string[self.content_range]
|
8
|
+
end
|
9
|
+
|
10
|
+
protected
|
11
|
+
|
12
|
+
def join_range(a,b)
|
13
|
+
return b if a.nil?
|
14
|
+
return a if b.nil?
|
15
|
+
(a.begin + b.begin)...((a.end >= 0 ? 0 : a.end) + b.end)
|
16
|
+
end
|
17
|
+
|
18
|
+
def scan_node(scanner)
|
19
|
+
scanner.skip_until(/(?=<(\w+)([^>]*)>)/m)
|
20
|
+
start = scanner.pos
|
21
|
+
|
22
|
+
return nil if scanner[2].nil?
|
23
|
+
|
24
|
+
s = if scanner[2].empty? || scanner[2][-1] != 47 #'/'
|
25
|
+
tag = "</#{scanner[1]}>"
|
26
|
+
scanner.scan_until(Regexp.new(tag, Regexp::MULTILINE))
|
27
|
+
else
|
28
|
+
scanner.scan_until(/>/)
|
29
|
+
end
|
30
|
+
|
31
|
+
s.nil? ? nil : [s, start..(-scanner.restsize)]
|
32
|
+
end
|
33
|
+
|
34
|
+
def content_node(scanner)
|
35
|
+
s, range = scan_node(scanner)
|
36
|
+
s.nil? ? nil : Element.new(self, join_range(content_range, range), s)
|
37
|
+
end
|
38
|
+
|
39
|
+
#def regex_node(scanner, start_regex, finish_regex)
|
40
|
+
# scanner.skip_until(start_regex)
|
41
|
+
# start = scanner.pos
|
42
|
+
# s = scanner.scan_until(finish_regex)
|
43
|
+
|
44
|
+
# s.nil? ? nil : Element.new(self, join_range(string_range, start..(-scanner.restsize)), s)
|
45
|
+
#end
|
46
|
+
|
47
|
+
def parse_path(path)
|
48
|
+
path =~ /^([^\[]+)(\[(.*)\])?/
|
49
|
+
[$1, $3]
|
50
|
+
end
|
51
|
+
|
52
|
+
def select_by_paths(paths, selected=[])
|
53
|
+
if paths.empty?
|
54
|
+
selected << self
|
55
|
+
return
|
56
|
+
end
|
57
|
+
|
58
|
+
tag, predicate = parse_path(paths.shift)
|
59
|
+
|
60
|
+
case tag
|
61
|
+
when '.', '/.'
|
62
|
+
selected << self
|
63
|
+
|
64
|
+
when '..', '/..'
|
65
|
+
parent.select_by_paths(paths.dup, selected) unless self.parent.nil?
|
66
|
+
|
67
|
+
when '*', '/*'
|
68
|
+
selected.concat(children)
|
69
|
+
|
70
|
+
when /^\/?([^\/]+)/
|
71
|
+
if $1[0] == 64 #@
|
72
|
+
attr, value = parse_predicate($1[1..-1])
|
73
|
+
value = value[1...-1] unless value.nil?
|
74
|
+
selected << self.attributes[attr] if attribute_matches?(self, attr, value)
|
75
|
+
|
76
|
+
else
|
77
|
+
children.each do |node|
|
78
|
+
node.select_by_paths(paths.dup, selected) if node.name == $1
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
when /^\/\/([^\/]+)/
|
83
|
+
#if $1[0] == 64 #@
|
84
|
+
|
85
|
+
# select_by_predicate(tag, children).each do |node|
|
86
|
+
#
|
87
|
+
# node.select_by_paths(paths.dup, selected)
|
88
|
+
# end
|
89
|
+
#else
|
90
|
+
children.each do |node|
|
91
|
+
# lazy evaluation... as constructed the search stops if a node by the given
|
92
|
+
# name is found. As commented out, will search the ENTIRE document
|
93
|
+
# effectively parsing the whole thing.
|
94
|
+
selected << node if node.name == $1
|
95
|
+
node.select_by_paths([tag], selected)
|
96
|
+
#if node.name == $1
|
97
|
+
# selected << node
|
98
|
+
#else
|
99
|
+
# node.select_by_paths([tag], selected)
|
100
|
+
#end
|
101
|
+
end
|
102
|
+
#end
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
else
|
107
|
+
raise ArgumentError, "Unsupported tag format: #{tag}"
|
108
|
+
end
|
109
|
+
|
110
|
+
select_by_predicate(predicate, selected)
|
111
|
+
end
|
112
|
+
|
113
|
+
def parse_predicate(predicate)
|
114
|
+
predicate.split(/[=><]/)
|
115
|
+
end
|
116
|
+
|
117
|
+
def attribute_matches?(node, attr, value)
|
118
|
+
attributes = node.attributes
|
119
|
+
attributes.has_key?(attr) && (value.nil? || attributes[attr] == value)
|
120
|
+
end
|
121
|
+
|
122
|
+
def select_by_predicate(predicate, selected)
|
123
|
+
return selected if predicate.nil?
|
124
|
+
|
125
|
+
path, value = parse_predicate(predicate)
|
126
|
+
case path
|
127
|
+
#when /^\d+$/
|
128
|
+
#when /^last\(\)(.*)/
|
129
|
+
when /^@([^=]+)/
|
130
|
+
|
131
|
+
attr = $1
|
132
|
+
value = value[1...-1] unless value.nil?
|
133
|
+
selected.delete_if do |node|
|
134
|
+
!attribute_matches?(node, attr, value)
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
|
139
|
+
selected
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<out>has ex: 2
|
3
|
+
has ex, eq null: 1
|
4
|
+
has ex, measure null: 4
|
5
|
+
has ex, neq null: 1
|
6
|
+
has ex, measure non-null: 1
|
7
|
+
not has ex: 3
|
8
|
+
not has ex, eq null: 4
|
9
|
+
not has ex, measure null: 1
|
10
|
+
has why, eq value: 1
|
11
|
+
has why, neq value: 1</out>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<out>
|
3
|
+
This should come out fasolatido:
|
4
|
+
fasolatido
|
5
|
+
This should come out doremifasolatido:
|
6
|
+
doremifasolatido
|
7
|
+
This should come out do-do-remi-mi1-mi2fasolatido-fa--so-:
|
8
|
+
do-do-remi-mi1-mi2fasolatido-fa--so-
|
9
|
+
This should come out solatidoG#:
|
10
|
+
solatidoG#
|
11
|
+
This should come out relatidoABb:
|
12
|
+
relatidoABb
|
13
|
+
This should come out domitiACD:
|
14
|
+
domitiACD</out>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
2
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
3
|
+
|
4
|
+
<!-- FileName: PREDICATE01 -->
|
5
|
+
<!-- Document: http://www.w3.org/TR/xpath -->
|
6
|
+
<!-- DocVersion: 19991116 -->
|
7
|
+
<!-- Section: 3.4 -->
|
8
|
+
<!-- Creator: David Marston -->
|
9
|
+
<!-- Purpose: Test of implied conversion to boolean. -->
|
10
|
+
|
11
|
+
<xsl:template match="doc">
|
12
|
+
<out>
|
13
|
+
<xsl:value-of select="a[true()=4]"/>
|
14
|
+
<!-- Always true; positive numbers convert to true. -->
|
15
|
+
</out>
|
16
|
+
</xsl:template>
|
17
|
+
|
18
|
+
</xsl:stylesheet>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# FileName: PREDICATE02
|
2
|
+
# Document: http://www.w3.org/TR/xpath
|
3
|
+
# DocVersion: 19991116
|
4
|
+
# Section: 3.4
|
5
|
+
# Creator: David Marston
|
6
|
+
# Purpose: Test of implied conversion to boolean.
|
7
|
+
a[true()='stringwithchars']
|
8
|
+
# Always true; nonzero-length strings convert to true.
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
2
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
3
|
+
|
4
|
+
<!-- FileName: PREDICATE02 -->
|
5
|
+
<!-- Document: http://www.w3.org/TR/xpath -->
|
6
|
+
<!-- DocVersion: 19991116 -->
|
7
|
+
<!-- Section: 3.4 -->
|
8
|
+
<!-- Creator: David Marston -->
|
9
|
+
<!-- Purpose: Test of implied conversion to boolean. -->
|
10
|
+
|
11
|
+
<xsl:template match="doc">
|
12
|
+
<out>
|
13
|
+
<xsl:value-of select="a[true()='stringwithchars']"/>
|
14
|
+
<!-- Always true; nonzero-length strings convert to true. -->
|
15
|
+
</out>
|
16
|
+
</xsl:template>
|
17
|
+
|
18
|
+
</xsl:stylesheet>
|