Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <?xml-stylesheet href="test-to-html.xsl" type="text/xml"?>
  3. <!--
  4.  Copyright (c) 2003 World Wide Web Consortium,
  5.  
  6.  (Massachusetts Institute of Technology, European Research Consortium for
  7.  Informatics and Mathematics, Keio University). All Rights Reserved. This
  8.  work is distributed under the W3C(r) Software License [1] in the hope that
  9.  it will be useful, but WITHOUT ANY WARRANTY; without even the implied
  10.  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11.  
  12.  [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
  13. -->
  14.  
  15. <!DOCTYPE test SYSTEM "dom3.dtd" [
  16.   <!ENTITY % entities SYSTEM "dom3xpathents.ent">
  17.   %entities;
  18. ]>
  19. <test xmlns="&level3;" name="Conformance_Expressions">
  20.   <metadata>
  21.     <title>Conformance_Expressions</title>
  22.     <creator>Bob Clary</creator>
  23.     <description>
  24.       1.3 Conformance - Iterate over a list of strings containing
  25.       valid XPath expressions, calling XPathEvaluator.createExpression
  26.       for each. If no expections are thrown and each result is non-null,
  27.       then the test passes.
  28.     </description>
  29.     <date qualifier="created">2003-11-18</date>
  30.     <subject resource="&spec;#Conformance"/>
  31.     <subject resource="&spec;#XPathEvaluator"/>
  32.     <subject resource="&spec;#XPathEvaluator-createNSResolver"/>
  33.     <subject resource="&spec;#XPathEvaluator-createExpression"/>
  34.     <subject resource="&spec;#XPathNSResolver"/>
  35.   </metadata>
  36.  
  37.   <!-- Standard Variables -->
  38.  
  39.   <var name="doc"         type="Document"/>
  40.   <var name="resolver"    type="XPathNSResolver"/>
  41.   <var name="evaluator"   type="XPathEvaluator"/>
  42.  
  43.   <!-- Inputs -->
  44.  
  45.   <var name="expression"           type="DOMString"/>
  46.  
  47.   <!-- Test Variables -->
  48.  
  49.   <var name="expressionList"       type="List"/>
  50.   <var name="xpathexpression"      type="XPathExpression"/>
  51.  
  52.   <load var="doc" href="staffNS" willBeModified="false"/>
  53.  
  54.   <createXPathEvaluator var='evaluator' document='doc'/>
  55.  
  56.   <createNSResolver var="resolver" obj="evaluator" nodeResolver="doc"/>
  57.  
  58.   <!-- test root absolute expression -->
  59.   <append collection="expressionList" item="&quot;/&quot;"/>
  60.  
  61.   <!-- test verbose axes and basic node tests -->
  62.   <append collection="expressionList" item="&quot;child::comment()&quot;"/>
  63.   <append collection="expressionList" item="&quot;child::text()&quot;"/>
  64.   <append collection="expressionList" item="&quot;child::processing-instruction()&quot;"/>
  65.   <append collection="expressionList" item="&quot;child::processing-instruction('name')&quot;"/>
  66.   <append collection="expressionList" item="&quot;child::node()&quot;"/>
  67.   <append collection="expressionList" item="&quot;child::*&quot;"/>
  68.   <append collection="expressionList" item="&quot;child::nist:*&quot;"/>
  69.   <append collection="expressionList" item="&quot;child::employee&quot;"/>
  70.  
  71.   <append collection="expressionList" item="&quot;descendant::comment()&quot;"/>
  72.   <append collection="expressionList" item="&quot;descendant::text()&quot;"/>
  73.   <append collection="expressionList" item="&quot;descendant::processing-instruction()&quot;"/>
  74.   <append collection="expressionList" item="&quot;descendant::processing-instruction('name')&quot;"/>
  75.   <append collection="expressionList" item="&quot;descendant::node()&quot;"/>
  76.   <append collection="expressionList" item="&quot;descendant::*&quot;"/>
  77.   <append collection="expressionList" item="&quot;descendant::nist:*&quot;"/>
  78.   <append collection="expressionList" item="&quot;descendant::employee&quot;"/>
  79.  
  80.   <append collection="expressionList" item="&quot;parent::comment()&quot;"/>
  81.   <append collection="expressionList" item="&quot;parent::text()&quot;"/>
  82.   <append collection="expressionList" item="&quot;parent::processing-instruction()&quot;"/>
  83.   <append collection="expressionList" item="&quot;parent::processing-instruction('name')&quot;"/>
  84.   <append collection="expressionList" item="&quot;parent::node()&quot;"/>
  85.   <append collection="expressionList" item="&quot;parent::*&quot;"/>
  86.   <append collection="expressionList" item="&quot;parent::nist:*&quot;"/>
  87.   <append collection="expressionList" item="&quot;parent::employee&quot;"/>
  88.  
  89.   <append collection="expressionList" item="&quot;ancestor::comment()&quot;"/>
  90.   <append collection="expressionList" item="&quot;ancestor::text()&quot;"/>
  91.   <append collection="expressionList" item="&quot;ancestor::processing-instruction()&quot;"/>
  92.   <append collection="expressionList" item="&quot;ancestor::processing-instruction('name')&quot;"/>
  93.   <append collection="expressionList" item="&quot;ancestor::node()&quot;"/>
  94.   <append collection="expressionList" item="&quot;ancestor::*&quot;"/>
  95.   <append collection="expressionList" item="&quot;ancestor::nist:*&quot;"/>
  96.   <append collection="expressionList" item="&quot;ancestor::employee&quot;"/>
  97.  
  98.   <append collection="expressionList" item="&quot;following-sibling::comment()&quot;"/>
  99.   <append collection="expressionList" item="&quot;following-sibling::text()&quot;"/>
  100.   <append collection="expressionList" item="&quot;following-sibling::processing-instruction()&quot;"/>
  101.   <append collection="expressionList" item="&quot;following-sibling::processing-instruction('name')&quot;"/>
  102.   <append collection="expressionList" item="&quot;following-sibling::node()&quot;"/>
  103.   <append collection="expressionList" item="&quot;following-sibling::*&quot;"/>
  104.   <append collection="expressionList" item="&quot;following-sibling::nist:*&quot;"/>
  105.   <append collection="expressionList" item="&quot;following-sibling::employee&quot;"/>
  106.  
  107.   <append collection="expressionList" item="&quot;preceding-sibling::comment()&quot;"/>
  108.   <append collection="expressionList" item="&quot;preceding-sibling::text()&quot;"/>
  109.   <append collection="expressionList" item="&quot;preceding-sibling::processing-instruction()&quot;"/>
  110.   <append collection="expressionList" item="&quot;preceding-sibling::processing-instruction('name')&quot;"/>
  111.   <append collection="expressionList" item="&quot;preceding-sibling::node()&quot;"/>
  112.   <append collection="expressionList" item="&quot;preceding-sibling::*&quot;"/>
  113.   <append collection="expressionList" item="&quot;preceding-sibling::nist:*&quot;"/>
  114.   <append collection="expressionList" item="&quot;preceding-sibling::employee&quot;"/>
  115.  
  116.   <append collection="expressionList" item="&quot;following::comment()&quot;"/>
  117.   <append collection="expressionList" item="&quot;following::text()&quot;"/>
  118.   <append collection="expressionList" item="&quot;following::processing-instruction()&quot;"/>
  119.   <append collection="expressionList" item="&quot;following::processing-instruction('name')&quot;"/>
  120.   <append collection="expressionList" item="&quot;following::node()&quot;"/>
  121.   <append collection="expressionList" item="&quot;following::*&quot;"/>
  122.   <append collection="expressionList" item="&quot;following::nist:*&quot;"/>
  123.   <append collection="expressionList" item="&quot;following::employee&quot;"/>
  124.  
  125.   <append collection="expressionList" item="&quot;preceding::comment()&quot;"/>
  126.   <append collection="expressionList" item="&quot;preceding::text()&quot;"/>
  127.   <append collection="expressionList" item="&quot;preceding::processing-instruction()&quot;"/>
  128.   <append collection="expressionList" item="&quot;preceding::processing-instruction('name')&quot;"/>
  129.   <append collection="expressionList" item="&quot;preceding::node()&quot;"/>
  130.   <append collection="expressionList" item="&quot;preceding::*&quot;"/>
  131.   <append collection="expressionList" item="&quot;preceding::nist:*&quot;"/>
  132.   <append collection="expressionList" item="&quot;preceding::employee&quot;"/>
  133.  
  134.   <append collection="expressionList" item="&quot;attribute::comment()&quot;"/>
  135.   <append collection="expressionList" item="&quot;attribute::text()&quot;"/>
  136.   <append collection="expressionList" item="&quot;attribute::processing-instruction()&quot;"/>
  137.   <append collection="expressionList" item="&quot;attribute::processing-instruction('name')&quot;"/>
  138.   <append collection="expressionList" item="&quot;attribute::node()&quot;"/>
  139.   <append collection="expressionList" item="&quot;attribute::*&quot;"/>
  140.   <append collection="expressionList" item="&quot;attribute::nist:*&quot;"/>
  141.   <append collection="expressionList" item="&quot;attribute::employee&quot;"/>
  142.  
  143.   <append collection="expressionList" item="&quot;namespace::comment()&quot;"/>
  144.   <append collection="expressionList" item="&quot;namespace::text()&quot;"/>
  145.   <append collection="expressionList" item="&quot;namespace::processing-instruction()&quot;"/>
  146.   <append collection="expressionList" item="&quot;namespace::processing-instruction('name')&quot;"/>
  147.   <append collection="expressionList" item="&quot;namespace::node()&quot;"/>
  148.   <append collection="expressionList" item="&quot;namespace::*&quot;"/>
  149.   <append collection="expressionList" item="&quot;namespace::nist:*&quot;"/>
  150.   <append collection="expressionList" item="&quot;namespace::employee&quot;"/>
  151.  
  152.   <append collection="expressionList" item="&quot;self::comment()&quot;"/>
  153.   <append collection="expressionList" item="&quot;self::text()&quot;"/>
  154.   <append collection="expressionList" item="&quot;self::processing-instruction()&quot;"/>
  155.   <append collection="expressionList" item="&quot;self::processing-instruction('name')&quot;"/>
  156.   <append collection="expressionList" item="&quot;self::node()&quot;"/>
  157.   <append collection="expressionList" item="&quot;self::*&quot;"/>
  158.   <append collection="expressionList" item="&quot;self::nist:*&quot;"/>
  159.   <append collection="expressionList" item="&quot;self::employee&quot;"/>
  160.  
  161.   <append collection="expressionList" item="&quot;descendant-or-self::comment()&quot;"/>
  162.   <append collection="expressionList" item="&quot;descendant-or-self::text()&quot;"/>
  163.   <append collection="expressionList" item="&quot;descendant-or-self::processing-instruction()&quot;"/>
  164.   <append collection="expressionList" item="&quot;descendant-or-self::processing-instruction('name')&quot;"/>
  165.   <append collection="expressionList" item="&quot;descendant-or-self::node()&quot;"/>
  166.   <append collection="expressionList" item="&quot;descendant-or-self::*&quot;"/>
  167.   <append collection="expressionList" item="&quot;descendant-or-self::nist:*&quot;"/>
  168.   <append collection="expressionList" item="&quot;descendant-or-self::employee&quot;"/>
  169.  
  170.   <append collection="expressionList" item="&quot;ancestor-or-self::comment()&quot;"/>
  171.   <append collection="expressionList" item="&quot;ancestor-or-self::text()&quot;"/>
  172.   <append collection="expressionList" item="&quot;ancestor-or-self::processing-instruction()&quot;"/>
  173.   <append collection="expressionList" item="&quot;ancestor-or-self::processing-instruction('name')&quot;"/>
  174.   <append collection="expressionList" item="&quot;ancestor-or-self::node()&quot;"/>
  175.   <append collection="expressionList" item="&quot;ancestor-or-self::*&quot;"/>
  176.   <append collection="expressionList" item="&quot;ancestor-or-self::nist:*&quot;"/>
  177.   <append collection="expressionList" item="&quot;ancestor-or-self::employee&quot;"/>
  178.  
  179.   <!-- test common abbreviations -->
  180.   <append collection="expressionList" item="&quot;comment()&quot;"/>
  181.   <append collection="expressionList" item="&quot;text()&quot;"/>
  182.   <append collection="expressionList" item="&quot;processing-instruction()&quot;"/>
  183.   <append collection="expressionList" item="&quot;processing-instruction('name')&quot;"/>
  184.   <append collection="expressionList" item="&quot;node()&quot;"/>
  185.   <append collection="expressionList" item="&quot;*&quot;"/>
  186.   <append collection="expressionList" item="&quot;nist:*&quot;"/>
  187.   <append collection="expressionList" item="&quot;employee&quot;"/>
  188.  
  189.   <append collection="expressionList" item="&quot;.//comment()&quot;"/>
  190.   <append collection="expressionList" item="&quot;.//text()&quot;"/>
  191.   <append collection="expressionList" item="&quot;.//processing-instruction()&quot;"/>
  192.   <append collection="expressionList" item="&quot;.//processing-instruction('name')&quot;"/>
  193.   <append collection="expressionList" item="&quot;.//node()&quot;"/>
  194.   <append collection="expressionList" item="&quot;.//*&quot;"/>
  195.   <append collection="expressionList" item="&quot;.//nist:*&quot;"/>
  196.   <append collection="expressionList" item="&quot;.//employee&quot;"/>
  197.  
  198.   <append collection="expressionList" item="&quot;../comment()&quot;"/>
  199.   <append collection="expressionList" item="&quot;../text()&quot;"/>
  200.   <append collection="expressionList" item="&quot;../processing-instruction()&quot;"/>
  201.   <append collection="expressionList" item="&quot;../processing-instruction('name')&quot;"/>
  202.   <append collection="expressionList" item="&quot;../node()&quot;"/>
  203.   <append collection="expressionList" item="&quot;../*&quot;"/>
  204.   <append collection="expressionList" item="&quot;../nist:*&quot;"/>
  205.   <append collection="expressionList" item="&quot;../employee&quot;"/>
  206.  
  207.   <append collection="expressionList" item="&quot;@attributename&quot;"/>
  208.  
  209.   <append collection="expressionList" item="&quot;./comment()&quot;"/>
  210.   <append collection="expressionList" item="&quot;./text()&quot;"/>
  211.   <append collection="expressionList" item="&quot;./processing-instruction()&quot;"/>
  212.   <append collection="expressionList" item="&quot;./processing-instruction('name')&quot;"/>
  213.   <append collection="expressionList" item="&quot;./node()&quot;"/>
  214.   <append collection="expressionList" item="&quot;./*&quot;"/>
  215.   <append collection="expressionList" item="&quot;./nist:*&quot;"/>
  216.   <append collection="expressionList" item="&quot;./employee&quot;"/>
  217.  
  218.   <!-- test Union -->
  219.   <append collection="expressionList" item="&quot;comment() | text() | processing-instruction() | node()&quot;"/>
  220.  
  221.   <!-- test various predicates -->
  222.  
  223.   <append collection="expressionList" item="&quot;employee[address]&quot;"/>
  224.   <append collection="expressionList" item="&quot;employee/address[@street]&quot;"/>
  225.   <append collection="expressionList" item="&quot;employee[position='Computer Specialist']&quot;"/>
  226.   <append collection="expressionList" item="&quot;employee[position!='Computer Specialist']&quot;"/>
  227.   <append collection="expressionList" item="&quot;employee[gender='Male' or gender='Female']&quot;"/>
  228.   <append collection="expressionList" item="&quot;employee[gender!='Male' and gender!='Female']&quot;"/>
  229.   <append collection="expressionList" item="&quot;employee/address[@street='Yes']&quot;"/>
  230.   <append collection="expressionList" item="&quot;employee/address[@street!='Yes']&quot;"/>
  231.   <append collection="expressionList" item="&quot;employee[position()=1]&quot;"/>
  232.   <append collection="expressionList" item="&quot;employee[1]&quot;"/>
  233.   <append collection="expressionList" item="&quot;employee[position()=last()]&quot;"/>
  234.   <append collection="expressionList" item="&quot;employee[last()]&quot;"/>
  235.   <append collection="expressionList" item="&quot;employee[position()&gt;1 and position&lt;last()]&quot;"/>
  236.   <append collection="expressionList" item="&quot;employee[position()&gt;=1 and position&lt;=last()]&quot;"/>
  237.   <append collection="expressionList" item="&quot;employee[count(.)&gt;0]&quot;"/>
  238.   <append collection="expressionList" item="&quot;employee[position() mod 2=0]&quot;"/>
  239.   <append collection="expressionList" item="&quot;employee[position() mod -2=0]&quot;"/>
  240.   <append collection="expressionList" item="&quot;employee[position() div 2=0]&quot;"/>
  241.   <append collection="expressionList" item="&quot;employee[position() div -2=-1]&quot;"/>
  242.   <append collection="expressionList" item="&quot;employee[position() div 2 * 2=position()]&quot;"/>
  243.   <append collection="expressionList" item="&quot;employee[3 &gt; 2 &gt; 1]&quot;"/>
  244.   <append collection="expressionList" item="&quot;id('CANADA')&quot;"/>
  245.   <append collection="expressionList" item="&quot;*[local-name()='employee']&quot;"/>
  246.   <append collection="expressionList" item="&quot;*[local-name(.)='employee']&quot;"/>
  247.   <append collection="expressionList" item="&quot;*[local-name(employee)='employee']&quot;"/>
  248.   <append collection="expressionList" item="&quot;*[local-name()='employee']&quot;"/>
  249.   <append collection="expressionList" item="&quot;*[namespace-uri()='http://www.nist.gov']&quot;"/>
  250.   <append collection="expressionList" item="&quot;*[name()='nist:employee']&quot;"/>
  251.   <append collection="expressionList" item="&quot;*[string()]&quot;"/>
  252.   <append collection="expressionList" item="&quot;*[string(10 div foo)='NaN']&quot;"/>
  253.   <append collection="expressionList" item="&quot;*[concat('a', 'b', 'c')]&quot;"/>
  254.   <append collection="expressionList" item="&quot;*[starts-with('employee', 'emp')]&quot;"/>
  255.   <append collection="expressionList" item="&quot;*[contains('employee', 'emp')]&quot;"/>
  256.   <append collection="expressionList" item="&quot;*[substring-before('employeeId', 'Id')]&quot;"/>
  257.   <append collection="expressionList" item="&quot;*[substring-after('employeeId', 'employee')]&quot;"/>
  258.   <append collection="expressionList" item="&quot;*[substring('employeeId', 4)]&quot;"/>
  259.   <append collection="expressionList" item="&quot;*[substring('employeeId', 4, 5)]&quot;"/>
  260.   <append collection="expressionList" item="&quot;*[string-length()=2]&quot;"/>
  261.   <append collection="expressionList" item="&quot;*[string-length(.)=string-length(normalize-space(.))]&quot;"/>
  262.   <append collection="expressionList" item="&quot;*[translate('bar', 'abc', 'ABC')='BAr']&quot;"/>
  263.   <append collection="expressionList" item="&quot;*[boolean(.)]&quot;"/>
  264.   <append collection="expressionList" item="&quot;*[not(boolean(.))]&quot;"/>
  265.   <append collection="expressionList" item="&quot;*[true()]&quot;"/>
  266.   <append collection="expressionList" item="&quot;*[false()]&quot;"/>
  267.   <append collection="expressionList" item="&quot;*[lang('en')]&quot;"/>
  268.   <append collection="expressionList" item="&quot;*[number()]&quot;"/>
  269.   <append collection="expressionList" item="&quot;*[number('4')]&quot;"/>
  270.   <append collection="expressionList" item="&quot;*[floor(.)]&gt;0&quot;"/>
  271.   <append collection="expressionList" item="&quot;*[ceiling(.)]&lt;1&quot;"/>
  272.   <append collection="expressionList" item="&quot;*[round(number(.))=0]&lt;1&quot;"/>
  273.  
  274.   <for-each collection="expressionList" member="expression">
  275.     <createExpression var="xpathexpression"
  276.                       obj="evaluator"
  277.                       resolver="resolver"
  278.                       expression="expression"/>
  279.   </for-each>
  280. </test>
  281.