scxml 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. data/README +0 -0
  2. data/lib/scxml.rb +86 -0
  3. data/lib/scxml/document.rb +165 -0
  4. data/lib/scxml/element.rb +219 -0
  5. data/lib/scxml/xpath.rb +142 -0
  6. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate01.out +2 -0
  7. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate02.out +2 -0
  8. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate03.out +2 -0
  9. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate04.out +2 -0
  10. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate12.out +4 -0
  11. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate13.out +2 -0
  12. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate41.out +2 -0
  13. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate42.out +2 -0
  14. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate45.out +2 -0
  15. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate51.out +2 -0
  16. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate52.out +2 -0
  17. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate56.out +2 -0
  18. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate57.out +5 -0
  19. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/predicate/predicate58.out +11 -0
  20. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select01.out +2 -0
  21. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select02.out +4 -0
  22. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select03.out +2 -0
  23. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select04.out +14 -0
  24. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select12.out +2 -0
  25. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select13.out +13 -0
  26. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select41.out +5 -0
  27. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select42.out +5 -0
  28. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select45.out +5 -0
  29. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select51.out +5 -0
  30. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select52.out +3 -0
  31. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select56.out +7 -0
  32. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select57.out +7 -0
  33. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select58.out +5 -0
  34. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select60.out +5 -0
  35. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select62.out +2 -0
  36. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select63.out +2 -0
  37. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select76.out +2 -0
  38. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select81.out +10 -0
  39. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select82.out +2 -0
  40. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select83.out +7 -0
  41. data/test/scxml/Xalan_Conformance_Tests/REF_OUT/select/select84.out +8 -0
  42. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate01.txt +8 -0
  43. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate01.xml +7 -0
  44. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate01.xsl +18 -0
  45. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate02.txt +8 -0
  46. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate02.xml +7 -0
  47. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate02.xsl +18 -0
  48. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate04.txt +8 -0
  49. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate04.xml +7 -0
  50. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate04.xsl +18 -0
  51. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate07.txt +9 -0
  52. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate07.xml +7 -0
  53. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate07.xsl +20 -0
  54. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate08.txt +9 -0
  55. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate08.xml +7 -0
  56. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate08.xsl +20 -0
  57. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate10.txt +8 -0
  58. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate10.xml +7 -0
  59. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate10.xsl +20 -0
  60. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate14.txt +9 -0
  61. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate14.xml +9 -0
  62. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate14.xsl +20 -0
  63. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate15.txt +9 -0
  64. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate15.xml +9 -0
  65. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate15.xsl +20 -0
  66. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate16.txt +9 -0
  67. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate16.xml +9 -0
  68. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate16.xsl +20 -0
  69. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate17.txt +9 -0
  70. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate17.xml +11 -0
  71. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate17.xsl +20 -0
  72. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate36.txt +8 -0
  73. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate36.xml +7 -0
  74. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate36.xsl +20 -0
  75. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate48.txt +8 -0
  76. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate48.xml +21 -0
  77. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate48.xsl +22 -0
  78. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate49.txt +8 -0
  79. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate49.xml +21 -0
  80. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate49.xsl +22 -0
  81. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate50.txt +8 -0
  82. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate50.xml +21 -0
  83. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate50.xsl +22 -0
  84. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate51.txt +8 -0
  85. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate51.xml +21 -0
  86. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate51.xsl +22 -0
  87. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate52.txt +8 -0
  88. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate52.xml +21 -0
  89. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate52.xsl +22 -0
  90. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate53.txt +8 -0
  91. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate53.xml +21 -0
  92. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate53.xsl +22 -0
  93. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate54.txt +7 -0
  94. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate54.xml +21 -0
  95. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate54.xsl +21 -0
  96. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate55.txt +8 -0
  97. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate55.xml +21 -0
  98. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate55.xsl +22 -0
  99. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate56.txt +8 -0
  100. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate56.xml +21 -0
  101. data/test/scxml/Xalan_Conformance_Tests/predicate/predicate56.xsl +22 -0
  102. data/test/scxml/Xalan_Conformance_Tests/predicate/prepare.rb +34 -0
  103. data/test/scxml/Xalan_Conformance_Tests/select/prepare.rb +34 -0
  104. data/test/scxml/Xalan_Conformance_Tests/select/select01.txt +7 -0
  105. data/test/scxml/Xalan_Conformance_Tests/select/select01.xml +9 -0
  106. data/test/scxml/Xalan_Conformance_Tests/select/select01.xsl +19 -0
  107. data/test/scxml/Xalan_Conformance_Tests/select/select02.txt +7 -0
  108. data/test/scxml/Xalan_Conformance_Tests/select/select02.xml +4 -0
  109. data/test/scxml/Xalan_Conformance_Tests/select/select02.xsl +17 -0
  110. data/test/scxml/Xalan_Conformance_Tests/select/select03.txt +8 -0
  111. data/test/scxml/Xalan_Conformance_Tests/select/select03.xml +13 -0
  112. data/test/scxml/Xalan_Conformance_Tests/select/select03.xsl +19 -0
  113. data/test/scxml/Xalan_Conformance_Tests/select/select04.txt +12 -0
  114. data/test/scxml/Xalan_Conformance_Tests/select/select04.xml +12 -0
  115. data/test/scxml/Xalan_Conformance_Tests/select/select04.xsl +35 -0
  116. data/test/scxml/Xalan_Conformance_Tests/select/select12.txt +7 -0
  117. data/test/scxml/Xalan_Conformance_Tests/select/select12.xml +9 -0
  118. data/test/scxml/Xalan_Conformance_Tests/select/select12.xsl +19 -0
  119. data/test/scxml/Xalan_Conformance_Tests/select/select13.txt +13 -0
  120. data/test/scxml/Xalan_Conformance_Tests/select/select13.xml +18 -0
  121. data/test/scxml/Xalan_Conformance_Tests/select/select13.xsl +33 -0
  122. data/test/scxml/Xalan_Conformance_Tests/select/select41.txt +7 -0
  123. data/test/scxml/Xalan_Conformance_Tests/select/select41.xml +9 -0
  124. data/test/scxml/Xalan_Conformance_Tests/select/select41.xsl +23 -0
  125. data/test/scxml/Xalan_Conformance_Tests/select/select42.txt +8 -0
  126. data/test/scxml/Xalan_Conformance_Tests/select/select42.xml +9 -0
  127. data/test/scxml/Xalan_Conformance_Tests/select/select42.xsl +26 -0
  128. data/test/scxml/Xalan_Conformance_Tests/select/select45.txt +7 -0
  129. data/test/scxml/Xalan_Conformance_Tests/select/select45.xml +24 -0
  130. data/test/scxml/Xalan_Conformance_Tests/select/select45.xsl +25 -0
  131. data/test/scxml/Xalan_Conformance_Tests/select/select51.txt +7 -0
  132. data/test/scxml/Xalan_Conformance_Tests/select/select51.xml +24 -0
  133. data/test/scxml/Xalan_Conformance_Tests/select/select51.xsl +25 -0
  134. data/test/scxml/Xalan_Conformance_Tests/select/select52.txt +6 -0
  135. data/test/scxml/Xalan_Conformance_Tests/select/select52.xml +6 -0
  136. data/test/scxml/Xalan_Conformance_Tests/select/select52.xsl +23 -0
  137. data/test/scxml/Xalan_Conformance_Tests/select/select56.txt +7 -0
  138. data/test/scxml/Xalan_Conformance_Tests/select/select56.xml +29 -0
  139. data/test/scxml/Xalan_Conformance_Tests/select/select56.xsl +25 -0
  140. data/test/scxml/Xalan_Conformance_Tests/select/select57.txt +7 -0
  141. data/test/scxml/Xalan_Conformance_Tests/select/select57.xml +29 -0
  142. data/test/scxml/Xalan_Conformance_Tests/select/select57.xsl +25 -0
  143. data/test/scxml/Xalan_Conformance_Tests/select/select58.txt +7 -0
  144. data/test/scxml/Xalan_Conformance_Tests/select/select58.xml +17 -0
  145. data/test/scxml/Xalan_Conformance_Tests/select/select58.xsl +25 -0
  146. data/test/scxml/Xalan_Conformance_Tests/select/select60.txt +6 -0
  147. data/test/scxml/Xalan_Conformance_Tests/select/select60.xml +9 -0
  148. data/test/scxml/Xalan_Conformance_Tests/select/select60.xsl +25 -0
  149. data/test/scxml/Xalan_Conformance_Tests/select/select62.txt +6 -0
  150. data/test/scxml/Xalan_Conformance_Tests/select/select62.xml +5 -0
  151. data/test/scxml/Xalan_Conformance_Tests/select/select62.xsl +22 -0
  152. data/test/scxml/Xalan_Conformance_Tests/select/select63.txt +7 -0
  153. data/test/scxml/Xalan_Conformance_Tests/select/select63.xml +10 -0
  154. data/test/scxml/Xalan_Conformance_Tests/select/select63.xsl +19 -0
  155. data/test/scxml/Xalan_Conformance_Tests/select/select76.txt +7 -0
  156. data/test/scxml/Xalan_Conformance_Tests/select/select76.xml +6 -0
  157. data/test/scxml/Xalan_Conformance_Tests/select/select76.xsl +17 -0
  158. data/test/scxml/Xalan_Conformance_Tests/select/select81.txt +9 -0
  159. data/test/scxml/Xalan_Conformance_Tests/select/select81.xml +6 -0
  160. data/test/scxml/Xalan_Conformance_Tests/select/select81.xsl +24 -0
  161. data/test/scxml/Xalan_Conformance_Tests/select/select82.txt +9 -0
  162. data/test/scxml/Xalan_Conformance_Tests/select/select82.xml +5 -0
  163. data/test/scxml/Xalan_Conformance_Tests/select/select82.xsl +28 -0
  164. data/test/scxml/Xalan_Conformance_Tests/select/select83.txt +10 -0
  165. data/test/scxml/Xalan_Conformance_Tests/select/select83.xml +10 -0
  166. data/test/scxml/Xalan_Conformance_Tests/select/select83.xsl +32 -0
  167. data/test/scxml/Xalan_Conformance_Tests/select/select84.txt +11 -0
  168. data/test/scxml/Xalan_Conformance_Tests/select/select84.xml +10 -0
  169. data/test/scxml/Xalan_Conformance_Tests/select/select84.xsl +33 -0
  170. data/test/scxml/document_test.rb +231 -0
  171. data/test/scxml/element_test.rb +552 -0
  172. data/test/scxml_test_helper.rb +73 -0
  173. data/test/scxml_test_suite.rb +2 -0
  174. metadata +241 -0
@@ -0,0 +1,34 @@
1
+ require 'fileutils'
2
+ dir = File.dirname(__FILE__)
3
+
4
+ keepers = [1, 2, 3, 4, 12, 13, 41, 42, 45, 51, 52, 56, 57, 58, 60, 62, 63, 76, 81, 83, 82, 84]
5
+ #keepers = [1,2,4,7,8,10,16,14,15,17,36,48,49,50,51,52,53,54,55,56]
6
+
7
+ Dir.new(dir).each do |file|
8
+ next unless file =~ /(\d+)/
9
+ number = $1.to_i
10
+
11
+ File.delete(file) unless keepers.include?(number)
12
+ end
13
+
14
+ Dir.new(dir).each do |file|
15
+ next unless file =~ /(\d+).xsl/
16
+
17
+ text = File.readlines(file)
18
+ text.collect! do |line|
19
+ if line =~ /<!--/
20
+ line.gsub(/\s*<!--/, '#').gsub(/-->/, '')
21
+ elsif line =~ /select="(.*)"/
22
+ $1 + "\n"
23
+ else
24
+ nil
25
+ end
26
+ end
27
+
28
+ text.delete_if {|line| line.nil? }
29
+ text = text.join('')
30
+
31
+ File.open( file.chomp('.xsl') + ".txt", 'w') do |output|
32
+ output << text
33
+ end
34
+ end
@@ -0,0 +1,7 @@
1
+ # FileName: select01
2
+ # Document: http://www.w3.org/TR/xpath
3
+ # DocVersion: 19991116
4
+ # Section: 2
5
+ # Creator: Paul Dick
6
+ # Purpose: Test for absolute path selection.
7
+ /doc/a/b/@attr
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0"?>
2
+ <doc>
3
+ <a><b attr="test"/></a>
4
+ <c>
5
+ <d>
6
+ <e/>
7
+ </d>
8
+ </c>
9
+ </doc>
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0"?>
2
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
+
4
+ <!-- FileName: select01 -->
5
+ <!-- Document: http://www.w3.org/TR/xpath -->
6
+ <!-- DocVersion: 19991116 -->
7
+ <!-- Section: 2 -->
8
+ <!-- Creator: Paul Dick -->
9
+ <!-- Purpose: Test for absolute path selection.-->
10
+
11
+ <xsl:template match="/">
12
+ <out>
13
+ <xsl:for-each select="doc/c/d/e">
14
+ <xsl:value-of select="/doc/a/b/@attr"/>
15
+ </xsl:for-each>
16
+ </out>
17
+ </xsl:template>
18
+
19
+ </xsl:stylesheet>
@@ -0,0 +1,7 @@
1
+ # FileName: select02
2
+ # Document: http://www.w3.org/TR/xslt
3
+ # DocVersion: 19991116
4
+ # Section: 12.4
5
+ # Creator: Paul Dick
6
+ # Purpose: Test of current() function - just select it.
7
+ current()
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0"?>
2
+ <doc>
3
+ <foo>a</foo>
4
+ </doc>
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0"?>
2
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
+
4
+ <!-- FileName: select02 -->
5
+ <!-- Document: http://www.w3.org/TR/xslt -->
6
+ <!-- DocVersion: 19991116 -->
7
+ <!-- Section: 12.4 -->
8
+ <!-- Creator: Paul Dick -->
9
+ <!-- Purpose: Test of current() function - just select it. -->
10
+
11
+ <xsl:template match="doc">
12
+ <out>
13
+ <xsl:value-of select="current()"/>
14
+ </out>
15
+ </xsl:template>
16
+
17
+ </xsl:stylesheet>
@@ -0,0 +1,8 @@
1
+ # FileName: select03
2
+ # Document: http://www.w3.org/TR/xpath
3
+ # DocVersion: 19991116
4
+ # Section: 2
5
+ # Creator: Paul Dick
6
+ # Purpose: Test for select in for-each and current().
7
+ foo
8
+ //item[@type=current()/@name]
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0"?>
2
+ <doc>
3
+ <foo name="x">
4
+ <item type="z">a</item>
5
+ <item type="c">b</item>
6
+ <item type="x">c</item>
7
+ </foo>
8
+ <foo name="y">
9
+ <item type="y">d</item>
10
+ <item type="h">e</item>
11
+ <item type="k">f</item>
12
+ </foo>
13
+ </doc>
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0"?>
2
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
+
4
+ <!-- FileName: select03 -->
5
+ <!-- Document: http://www.w3.org/TR/xpath -->
6
+ <!-- DocVersion: 19991116 -->
7
+ <!-- Section: 2 -->
8
+ <!-- Creator: Paul Dick -->
9
+ <!-- Purpose: Test for select in for-each and current(). -->
10
+
11
+ <xsl:template match="doc">
12
+ <out>
13
+ <xsl:for-each select="foo">
14
+ <xsl:copy-of select="//item[@type=current()/@name]"/><xsl:text> </xsl:text>
15
+ </xsl:for-each>
16
+ </out>
17
+ </xsl:template>
18
+
19
+ </xsl:stylesheet>
@@ -0,0 +1,12 @@
1
+ # FileName: select04
2
+ # Document: http://www.w3.org/TR/xpath
3
+ # DocVersion: 19991116
4
+ # Section: 2
5
+ # Purpose: Test of unions, returned in document order.
6
+ fa
7
+ mi | do | fa | re
8
+ mi[@mi2='mi2'] | do | fa/so/@so | fa | mi/@* | re | fa/@fa | do/@do
9
+ .//*[@so]
10
+ *//la | //Bflat | re
11
+ fa/../mi | Aflat/natural/la | Csharp//* | /doc/do | *//ti
12
+ .
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0"?>
2
+ <!-- to test xsl:process and xsl:for-each -->
3
+ <doc>
4
+ <do do="-do-">do</do>
5
+ <re>re</re>
6
+ <mi mi1="-mi1-" mi2="mi2">mi</mi>
7
+ <fa fa="-fa-">fa<so so="-so-">so<la>la<ti>ti</ti>do</la></so></fa>
8
+ <Gsharp so="so+">G#</Gsharp>
9
+ <Aflat><natural><la>A</la></natural>Ab</Aflat>
10
+ <Bflat>Bb</Bflat>
11
+ <Csharp><natural>C</natural>C#<doublesharp>D</doublesharp></Csharp>
12
+ </doc>
@@ -0,0 +1,35 @@
1
+ <?xml version="1.0"?>
2
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
+
4
+ <!-- FileName: select04 -->
5
+ <!-- Document: http://www.w3.org/TR/xpath -->
6
+ <!-- DocVersion: 19991116 -->
7
+ <!-- Section: 2 -->
8
+ <!-- Purpose: Test of unions, returned in document order. -->
9
+
10
+ <xsl:template match="/">
11
+ <out>
12
+ <xsl:apply-templates/>
13
+ </out>
14
+ </xsl:template>
15
+
16
+ <xsl:template match="doc">
17
+ This should come out fasolatido:
18
+ <xsl:apply-templates select="fa"/>
19
+ This should come out doremifasolatido:
20
+ <xsl:apply-templates select="mi | do | fa | re"/>
21
+ This should come out do-do-remi-mi1-mi2fasolatido-fa--so-:
22
+ <xsl:apply-templates select="mi[@mi2='mi2'] | do | fa/so/@so | fa | mi/@* | re | fa/@fa | do/@do"/>
23
+ This should come out solatidoG#:
24
+ <xsl:apply-templates select=".//*[@so]"/>
25
+ This should come out relatidoABb:
26
+ <xsl:apply-templates select="*//la | //Bflat | re"/>
27
+ This should come out domitiACD:
28
+ <xsl:apply-templates select="fa/../mi | Aflat/natural/la | Csharp//* | /doc/do | *//ti"/>
29
+ </xsl:template>
30
+
31
+ <xsl:template match="@*">
32
+ <xsl:value-of select="."/>
33
+ </xsl:template>
34
+
35
+ </xsl:stylesheet>
@@ -0,0 +1,7 @@
1
+ # FileName: select12
2
+ # Document: http://www.w3.org/TR/xpath
3
+ # DocVersion: 19991116
4
+ # Section: 2
5
+ # Creator: David Marston
6
+ # Purpose: Test for select that comes up empty.
7
+ doc//Q
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0"?>
2
+ <doc>
3
+ <a><b attr="test"/></a>
4
+ <c>
5
+ <d>
6
+ <e/>
7
+ </d>
8
+ </c>
9
+ </doc>
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0"?>
2
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
+
4
+ <!-- FileName: select12 -->
5
+ <!-- Document: http://www.w3.org/TR/xpath -->
6
+ <!-- DocVersion: 19991116 -->
7
+ <!-- Section: 2 -->
8
+ <!-- Creator: David Marston -->
9
+ <!-- Purpose: Test for select that comes up empty.-->
10
+
11
+ <xsl:template match="/">
12
+ <out>
13
+ <xsl:for-each select="doc//Q">
14
+ <xsl:text>Found a Q!</xsl:text>
15
+ </xsl:for-each>
16
+ </out>
17
+ </xsl:template>
18
+
19
+ </xsl:stylesheet>
@@ -0,0 +1,13 @@
1
+ # FileName: select13
2
+ # Document: http://www.w3.org/TR/xslt
3
+ # DocVersion: 19991116
4
+ # Section: 8
5
+ # Creator: David Marston
6
+ # Purpose: Test that for-each doesn't care about current node
7
+ # Collect a node-set, outside any template
8
+ //OL
9
+ //comment()
10
+ .
11
+ OL//tag
12
+ $all/LI
13
+ .
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0"?>
2
+ <!-- Top comment -->
3
+ <OL>
4
+ <LI>item1</LI>
5
+ <!-- Upper Middle comment -->
6
+ <LI>item2</LI>
7
+ <LI>item3</LI>
8
+ <OL>
9
+ <LI>subitem1</LI>
10
+ <LI>subitem2</LI>
11
+ <OL>
12
+ <!-- Lower Middle comment -->
13
+ <LI>subsubitem</LI>
14
+ <tag/>
15
+ </OL>
16
+ </OL>
17
+ </OL>
18
+ <!-- Bottom comment -->
@@ -0,0 +1,33 @@
1
+ <?xml version="1.0"?>
2
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
+
4
+ <!-- FileName: select13 -->
5
+ <!-- Document: http://www.w3.org/TR/xslt -->
6
+ <!-- DocVersion: 19991116 -->
7
+ <!-- Section: 8 -->
8
+ <!-- Creator: David Marston -->
9
+ <!-- Purpose: Test that for-each doesn't care about current node -->
10
+
11
+ <!-- Collect a node-set, outside any template -->
12
+ <xsl:param name="all" select="//OL"/>
13
+
14
+ <xsl:template match="/">
15
+ <out>
16
+ <xsl:for-each select="//comment()">
17
+ <xsl:value-of select="."/><xsl:text>
18
+ </xsl:text>
19
+ </xsl:for-each>
20
+ <xsl:apply-templates select="OL//tag"/>
21
+ </out>
22
+ </xsl:template>
23
+
24
+ <xsl:template match="tag">
25
+ <xsl:text>Found the tag...
26
+ </xsl:text>
27
+ <xsl:for-each select="$all/LI">
28
+ <xsl:value-of select="."/><xsl:text>
29
+ </xsl:text>
30
+ </xsl:for-each>
31
+ </xsl:template>
32
+
33
+ </xsl:stylesheet>
@@ -0,0 +1,7 @@
1
+ # FileName: select41
2
+ # Document: http://www.w3.org/TR/Xpath
3
+ # DocVersion: 19991116
4
+ # Section: 3.3 Node Sets
5
+ # Purpose: NodeSet union using two absolute location paths# Expression001 in NIST suite
6
+ # Creator: Carmelo Montanez
7
+ .
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0"?>
2
+ <doc>
3
+ <sub1>
4
+ <child1>child1</child1>
5
+ </sub1>
6
+ <sub2>
7
+ <child2>child2</child2>
8
+ </sub2>
9
+ </doc>
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0"?>
2
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
+
4
+ <!-- FileName: select41 -->
5
+ <!-- Document: http://www.w3.org/TR/Xpath -->
6
+ <!-- DocVersion: 19991116 -->
7
+ <!-- Section: 3.3 Node Sets -->
8
+ <!-- Purpose: NodeSet union using two absolute location paths--><!-- Expression001 in NIST suite -->
9
+ <!-- Creator: Carmelo Montanez -->
10
+
11
+ <xsl:template match="/">
12
+ <out><xsl:text>
13
+ </xsl:text>
14
+ <xsl:apply-templates select = "/doc/sub1/child1|/doc/sub2/child2"/>
15
+ </out>
16
+ </xsl:template>
17
+
18
+ <xsl:template match="*">
19
+ <xsl:value-of select="."/><xsl:text>
20
+ </xsl:text>
21
+ </xsl:template>
22
+
23
+ </xsl:stylesheet>
@@ -0,0 +1,8 @@
1
+ # FileName: select42
2
+ # Document: http://www.w3.org/TR/Xpath
3
+ # DocVersion: 19991116
4
+ # Section: 3.3 Node Sets
5
+ # Purpose: NodeSet union using absolute and relative location paths
6
+ # Creator: Carmelo Montanez # Expression002 in NIST suite
7
+ doc
8
+ .
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0"?>
2
+ <doc>
3
+ <sub1>
4
+ <child1>child1</child1>
5
+ </sub1>
6
+ <sub2>
7
+ <child2>child2</child2>
8
+ </sub2>
9
+ </doc>
@@ -0,0 +1,26 @@
1
+ <?xml version="1.0"?>
2
+ <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
3
+
4
+ <!-- FileName: select42 -->
5
+ <!-- Document: http://www.w3.org/TR/Xpath -->
6
+ <!-- DocVersion: 19991116 -->
7
+ <!-- Section: 3.3 Node Sets -->
8
+ <!-- Purpose: NodeSet union using absolute and relative location paths-->
9
+ <!-- Creator: Carmelo Montanez --><!-- Expression002 in NIST suite -->
10
+
11
+ <xsl:template match="/">
12
+ <out><xsl:text>
13
+ </xsl:text>
14
+ <xsl:for-each select="doc">
15
+ <xsl:apply-templates select = "sub1/child1|/doc/sub2/child2"/>
16
+ </xsl:for-each>
17
+ </out>
18
+ </xsl:template>
19
+
20
+ <xsl:template match="*">
21
+ <xsl:value-of select="."/><xsl:text>
22
+ </xsl:text>
23
+ </xsl:template>
24
+
25
+ </xsl:stylesheet>
26
+
@@ -0,0 +1,7 @@
1
+ # FileName: select45
2
+ # Document: http://www.w3.org/TR/Xpath
3
+ # DocVersion: 19991116
4
+ # Section: 3.3 Node Sets
5
+ # Purpose: test union operator using two paths with predicates.
6
+ # Creator: Carmelo Montanez # Expression005 in NIST suite
7
+ name
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0"?>
2
+ <doc>
3
+ <book>
4
+ <author>
5
+ <name real="no">Carmelo Montanez</name>
6
+ <chapters>Nine</chapters>
7
+ <bibliography></bibliography>
8
+ </author>
9
+ </book>
10
+ <book>
11
+ <author>
12
+ <name real="na">David Marston</name>
13
+ <chapters>Seven</chapters>
14
+ <bibliography></bibliography>
15
+ </author>
16
+ </book>
17
+ <book>
18
+ <author>
19
+ <name real="yes">Mary Brady</name>
20
+ <chapters>Ten</chapters>
21
+ <bibliography></bibliography>
22
+ </author>
23
+ </book>
24
+ </doc>