Project

Profile

Help

Revision 74569bc0

Added by O'Neil Delpratt about 6 years ago

Added Saxon-C 0.3.1 samples directory to svn archive

View differences:

.gitattributes
458 458
latest9.5/samples/trax/xsl/postamble.txt svn_eol_002dstyle=native
459 459
latest9.5/samples/trax/xsl/preamble.txt svn_eol_002dstyle=native
460 460
latest9.5/samples/trax/xsl/text.xsl svn_eol_002dstyle=native
461
latest9.6/hec/samples/query/books.xml svn_mime_002dtype=application%2Fxml
462
latest9.6/hec/samples/test.xsl svn_mime_002dtype=application%2Fxml
463
latest9.6/hec/samples/trax/Simple2.out svn_mime_002dtype=application%2Fxml
464
latest9.6/hec/samples/trax/a2.out svn_mime_002dtype=application%2Fxml
465
latest9.6/hec/samples/trax/b3.out svn_mime_002dtype=application%2Fxml
466
latest9.6/hec/samples/trax/c4.out svn_mime_002dtype=application%2Fxml
467
latest9.6/hec/samples/trax/doc1.out svn_mime_002dtype=application%2Fxml
468
latest9.6/hec/samples/trax/exampleSimple2.out svn_mime_002dtype=application%2Fxml
469
latest9.6/hec/samples/trax/xml/baz.xml svn_mime_002dtype=application%2Fxml
470
latest9.6/hec/samples/trax/xml/cities.xml svn_mime_002dtype=application%2Fxml
471
latest9.6/hec/samples/trax/xml/embedded.xml svn_mime_002dtype=application%2Fxml
472
latest9.6/hec/samples/trax/xml/foo.xml svn_mime_002dtype=application%2Fxml
473
latest9.6/hec/samples/trax/xml/subdir1/foo2.xml svn_mime_002dtype=application%2Fxml
474
latest9.6/hec/samples/trax/xml/subdir1/subdir2/foo3.xml svn_mime_002dtype=application%2Fxml
475
latest9.6/hec/samples/trax/xml/withentityref.xml svn_mime_002dtype=application%2Fxml
476
latest9.6/hec/samples/trax/xsl/foo2.xsl svn_mime_002dtype=application%2Fxml
477
latest9.6/hec/samples/trax/xsl/foo3.xsl svn_mime_002dtype=application%2Fxml
461 478
latest9.6/hej/net/sf/saxon/option/cpp/SaxonCAPI.java svn_eol_002dstyle=native
462 479
latest9.6/hej/net/sf/saxon/option/cpp/SaxonCException.java svn_eol_002dstyle=native
463 480
latest9.6/hej/net/sf/saxon/option/cpp/SchemaValidatorForCpp.java svn_eol_002dstyle=native
latest9.6/hec/samples/cat.xml
1
<html>
2
   <body>
3
      <h2>My CD Collection</h2>
4
      <table border="1">
5
         <tr bgcolor="#9acd32">
6
            <th>Title</th>
7
            <th>Artist</th>
8
         </tr>
9
         <tr>
10
            <td>.</td>
11
            <td>.</td>
12
         </tr>
13
      </table>
14
   </body>
15
</html>
latest9.6/hec/samples/query/books-to-html.xq
1
xquery version "1.0";
2
  <html>
3
    <head>
4
      <title>A list of books</title>
5
    </head>
6
    <body>
7
      <h1>A list of books</h1>
8
      <p>Here are some interesting books:</p>
9
      <ul> {
10
        for $b in //BOOKS/ITEM
11
        order by $b/TITLE return
12
          <li><i> { string($b/TITLE) } </i> by { string($b/AUTHOR) } </li>
13
      } </ul>
14
    </body>
15
  </html>
16
    
latest9.6/hec/samples/query/books.dtd
1
<!ELEMENT AUTHOR ( #PCDATA ) >
2

  
3
<!ELEMENT BOOKLIST ( BOOKS, CATEGORIES ) >
4
<!ATTLIST BOOKLIST xmlns:xsi CDATA #IMPLIED >
5
<!ATTLIST BOOKLIST xsi:type CDATA #IMPLIED >
6
<!ATTLIST BOOKLIST xsi:noNamespaceSchemaLocation CDATA #IMPLIED >
7

  
8
<!ELEMENT BOOKS ( ITEM+ ) >
9

  
10
<!ELEMENT CATEGORIES ( CATEGORY+ ) >
11
<!ATTLIST CATEGORIES DESC CDATA #REQUIRED >
12

  
13
<!ELEMENT CATEGORY EMPTY >
14
<!ATTLIST CATEGORY CODE ID #REQUIRED >
15
<!ATTLIST CATEGORY DESC CDATA #REQUIRED >
16

  
17
<!ELEMENT DIMENSIONS ( #PCDATA ) >
18
<!ATTLIST DIMENSIONS UNIT NMTOKEN #REQUIRED >
19

  
20
<!ELEMENT ISBN ( #PCDATA ) >
21

  
22
<!ELEMENT ITEM ( TITLE, AUTHOR, PUBLISHER, PUB-DATE, LANGUAGE, PRICE, QUANTITY, ISBN, PAGES, DIMENSIONS, WEIGHT ) >
23
<!ATTLIST ITEM CAT NMTOKEN #REQUIRED >
24

  
25
<!ELEMENT LANGUAGE ( #PCDATA ) >
26

  
27
<!ELEMENT PAGES ( #PCDATA ) >
28

  
29
<!ELEMENT PRICE ( #PCDATA ) >
30

  
31
<!ELEMENT PUB-DATE ( #PCDATA ) >
32

  
33
<!ELEMENT PUBLISHER ( #PCDATA ) >
34

  
35
<!ELEMENT QUANTITY ( #PCDATA ) >
36

  
37
<!ELEMENT TITLE ( #PCDATA ) >
38

  
39
<!ELEMENT WEIGHT ( #PCDATA ) >
40
<!ATTLIST WEIGHT UNIT NMTOKEN #REQUIRED >
41
<!ATTLIST WEIGHT EXTRA NMTOKEN "Extra" >
latest9.6/hec/samples/query/books.xml
1
<?xml-stylesheet type="text/xsl" href="../styles/books.xsl"?><BOOKLIST xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
          xsi:noNamespaceSchemaLocation="books.xsd">
3
   <BOOKS>
4
      <ITEM CAT="MMP">
5
         <TITLE>Pride and Prejudice</TITLE>
6
         <AUTHOR>Jane Austen</AUTHOR>
7
         <PUBLISHER>Modern Library</PUBLISHER>
8
         <PUB-DATE>2002-12-31</PUB-DATE>
9
         <LANGUAGE>English</LANGUAGE>
10
         <PRICE>-0.10000000000000002</PRICE>
11
         <QUANTITY>187</QUANTITY>
12
         <ISBN>0679601686</ISBN>
13
         <PAGES>352</PAGES>
14
         <DIMENSIONS UNIT="in">8.3 5.7 1.1</DIMENSIONS>
15
         <WEIGHT UNIT="oz">6.1</WEIGHT>
16
      </ITEM>
17
      <ITEM CAT="P">
18
         <TITLE>Wuthering Heights</TITLE>
19
         <AUTHOR>Charlotte Brontë</AUTHOR>
20
         <PUBLISHER>Penguin Classics</PUBLISHER>
21
         <PUB-DATE>2002-12-31</PUB-DATE>
22
         <LANGUAGE>English</LANGUAGE>
23
         <PRICE>-0.10000000000000002</PRICE>
24
         <QUANTITY>113</QUANTITY>
25
         <ISBN>0141439556</ISBN>
26
         <PAGES>430</PAGES>
27
         <DIMENSIONS UNIT="in">1.0 5.2 7.8</DIMENSIONS>
28
         <WEIGHT UNIT="oz">11.2</WEIGHT>
29
      </ITEM>
30
      <ITEM CAT="P">
31
         <TITLE>Tess of the d'Urbervilles</TITLE>
32
         <AUTHOR>Thomas Hardy</AUTHOR>
33
         <PUBLISHER>Bantam Classics</PUBLISHER>
34
         <PUB-DATE>1984-05-01</PUB-DATE>
35
         <LANGUAGE>English</LANGUAGE>
36
         <PRICE>-0.10000000000000002</PRICE>
37
         <QUANTITY>85</QUANTITY>
38
         <ISBN>0553211684</ISBN>
39
         <PAGES>480</PAGES>
40
         <DIMENSIONS UNIT="in">6.8 4.2 0.8</DIMENSIONS>
41
         <WEIGHT UNIT="oz">7.7</WEIGHT>
42
      </ITEM>
43
      <ITEM CAT="P">
44
         <TITLE>Jude the Obscure</TITLE>
45
         <AUTHOR>Thomas Hardy</AUTHOR>
46
         <PUBLISHER>Penguin Classics</PUBLISHER>
47
         <PUB-DATE>1998-09-01</PUB-DATE>
48
         <LANGUAGE>English</LANGUAGE>
49
         <PRICE>-0.10000000000000002</PRICE>
50
         <QUANTITY>129</QUANTITY>
51
         <ISBN>0140435387</ISBN>
52
         <PAGES>528</PAGES>
53
         <DIMENSIONS UNIT="in">7.8 5.2 0.9</DIMENSIONS>
54
         <WEIGHT UNIT="oz">10.9</WEIGHT>
55
      </ITEM>
56
      <ITEM CAT="H">
57
         <TITLE>The Big Over Easy</TITLE>
58
         <AUTHOR>Jasper Fforde</AUTHOR>
59
         <PUBLISHER>Hodder &amp; Stoughton</PUBLISHER>
60
         <PUB-DATE>2005-07-11</PUB-DATE>
61
         <LANGUAGE>English</LANGUAGE>
62
         <PRICE>-0.10000000000000002</PRICE>
63
         <QUANTITY>129</QUANTITY>
64
         <ISBN>0340835672</ISBN>
65
         <PAGES>346</PAGES>
66
         <DIMENSIONS UNIT="cm">22.5 18.0 3.5</DIMENSIONS>
67
         <WEIGHT UNIT="g">390</WEIGHT>
68
      </ITEM>
69
      <ITEM CAT="P">
70
         <TITLE>The Eyre Affair</TITLE>
71
         <AUTHOR>Jasper Fforde</AUTHOR>
72
         <PUBLISHER>Penguin</PUBLISHER>
73
         <PUB-DATE>2003-02-25</PUB-DATE>
74
         <LANGUAGE>English</LANGUAGE>
75
         <PRICE>-0.10000000000000002</PRICE>
76
         <QUANTITY>129</QUANTITY>
77
         <ISBN>0142001805</ISBN>
78
         <PAGES>384</PAGES>
79
         <DIMENSIONS UNIT="in">7.8 5.0 0.9</DIMENSIONS>
80
         <WEIGHT UNIT="oz">9.0</WEIGHT>
81
      </ITEM>
82
   </BOOKS>
83
   <CATEGORIES DESC="Miscellaneous categories">
84
      <CATEGORY CODE="P" DESC="Paperback"/>
85
      <CATEGORY CODE="MMP" DESC="Mass-market Paperback"/>
86
      <CATEGORY CODE="H" DESC="Hard Cover"/>
87
   </CATEGORIES>
88
</BOOKLIST>
latest9.6/hec/samples/query/books.xsd
1
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
2
           xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning">
3
    
4
 <xs:element name="BOOKLIST">
5
  <xs:complexType>
6
   <xs:sequence>
7
    <xs:element ref="BOOKS"/>
8
    <xs:element ref="CATEGORIES"/>
9
   </xs:sequence>
10
  </xs:complexType>
11
 </xs:element>
12

  
13
 <xs:element name="BOOKS">
14
  <xs:complexType>
15
   <xs:sequence>
16
    <xs:element ref="ITEM" maxOccurs="unbounded"/>
17
   </xs:sequence>
18
   <xs:assert test="count(ITEM) le 10000" vc:minVersion="1.1"/>
19
  </xs:complexType> 
20
 </xs:element>
21

  
22
 <xs:element name="CATEGORIES">
23
  <xs:complexType mixed="true">
24
   <xs:sequence minOccurs="0" maxOccurs="unbounded">
25
    <xs:element ref="CATEGORY"/>
26
   </xs:sequence>
27
   <xs:attribute name="DESC" type="xs:string" use="required"/>
28
  </xs:complexType>
29
 </xs:element>
30
 <xs:element name="CATEGORY">
31
  <xs:complexType>
32
   <xs:attribute name="CODE" type="xs:ID" use="required"/>
33
   <xs:attribute name="DESC" type="xs:string" use="required"/>
34
   <xs:attribute name="NOTE" type="xs:string" use="optional"/>
35
  </xs:complexType>
36
 </xs:element>
37

  
38
 <xs:element name="ITEM">
39
  <xs:complexType>
40
   <xs:sequence>
41
    <xs:element name="TITLE" type="xs:string"/>
42
    <xs:element name="AUTHOR" type="xs:string"/>
43
    <xs:element name="PUBLISHER" type="xs:string"/>
44
    <xs:element name="PUB-DATE" type="xs:date"/>
45
    <xs:element name="LANGUAGE" type="languageType"/>
46
    <xs:element name="PRICE" type="moneyType"/>
47
    <xs:element name="QUANTITY" type="xs:integer"/>
48
    <xs:element name="ISBN" type="ISBNType"/>                      
49
    <xs:element name="PAGES" type="xs:integer"/>
50
    <xs:element name="DIMENSIONS" type="dimensionsType"/>
51
    <xs:element name="WEIGHT" type="weightType"/>
52
   </xs:sequence>
53
   <xs:attribute name="CAT" type="xs:IDREF" use="required"/>
54
   <xs:attribute name="TAX" type="xs:NMTOKEN" use="optional" default="V"/>
55
  </xs:complexType>
56
 </xs:element>
57
 
58
 <xs:simpleType name="languageType">
59
  <xs:restriction base="xs:string">
60
   <xs:enumeration value="English"/>
61
   <xs:enumeration value="French"/>
62
   <xs:enumeration value="German"/>
63
   <xs:enumeration value="Spanish"/>
64
  </xs:restriction>
65
 </xs:simpleType>
66
 
67
 <xs:complexType name="moneyType">
68
  <xs:simpleContent>
69
   <xs:extension base="xs:decimal">
70
    <xs:attribute name="currency" type="currencyType"/>
71
   </xs:extension> 
72
  </xs:simpleContent>
73
 </xs:complexType>
74
 
75
 <xs:simpleType name="currencyType">
76
  <xs:restriction base="xs:string">
77
   <xs:enumeration value="USD"/>
78
   <xs:enumeration value="GBP"/>
79
   <xs:enumeration value="EUR"/>
80
   <xs:enumeration value="CAD"/>
81
  </xs:restriction>
82
 </xs:simpleType> 
83
 
84
 <xs:simpleType name="ISBNType">
85
  <xs:restriction base="xs:string">
86
   <xs:pattern value="[0-9]{9}[0-9X]"/>
87
  </xs:restriction>
88
 </xs:simpleType>     
89
 
90
 <xs:complexType name="dimensionsType">
91
  <xs:simpleContent>
92
   <xs:extension base="dimensionsContentType"> 
93
    <xs:attribute name="UNIT" type="lengthUnitType"/>
94
   </xs:extension> 
95
  </xs:simpleContent>
96
 </xs:complexType>
97
 
98
 <xs:simpleType name="dimensionsContentType">
99
  <xs:restriction>
100
   <xs:simpleType>
101
    <xs:list itemType="dimensionType"/>
102
   </xs:simpleType>     
103
   <xs:length value="3"/>
104
  </xs:restriction>
105
 </xs:simpleType>  
106
 
107
 <xs:simpleType name="lengthUnitType">
108
  <xs:restriction base="xs:string">
109
   <xs:enumeration value="in"/>
110
   <xs:enumeration value="cm"/>
111
  </xs:restriction>
112
 </xs:simpleType> 
113
 
114
 <xs:simpleType name="dimensionType">
115
  <xs:restriction base="xs:decimal">
116
   <xs:minExclusive value="0.00"/>
117
  </xs:restriction>
118
 </xs:simpleType> 
119
 
120
 <xs:complexType name="weightType">
121
  <xs:simpleContent>
122
   <xs:extension base="xs:decimal">
123
    <xs:attribute name="UNIT" type="weightUnitType"/>
124
   </xs:extension> 
125
  </xs:simpleContent>
126
 </xs:complexType>
127
 
128
 <xs:simpleType name="weightUnitType">
129
  <xs:restriction base="xs:string">
130
   <xs:enumeration value="oz"/>
131
   <xs:enumeration value="g"/>
132
  </xs:restriction>
133
 </xs:simpleType>    
134
    
135
</xs:schema>
latest9.6/hec/samples/test.xsl
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<xsl:stylesheet version="2.0"
3
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4

  
5
<xsl:template >
6
  <html>
7
  <body>
8
  <h2>My CD Collection</h2>
9
  <table border="1">
10
    <tr bgcolor="#9acd32">
11
      <th>Title</th>
12
      <th>Artist</th>
13
    </tr>
14
    <tr>
15
      <td>.</td>
16
      <td>.</td>
17
    </tr>
18
  </table>
19
  </body>
20
  </html>
21
</xsl:template>
22

  
23
</xsl:stylesheet>
latest9.6/hec/samples/trax/Simple2.out
1
<?xml version="1.0" encoding="iso-8859-1"?><!--EE 9.3.0.1--><?xml-stylesheet type="text/xsl" href="../xsl/foo.xsl" title="default-stylesheet"?><foo:document xmlns:foo="http://apache.org/foo" xmlns:bar="http://apache.org/bar" file-name="test" file-path="work" creation-date="971255692078">
2
<bar><param-val>default param value, text from my-var in inc2.xsl</param-val><data>MyBar</data></bar>
3
</foo:document>
latest9.6/hec/samples/trax/a2.out
1
<?xml version="1.0" encoding="UTF-8"?><document>gespräch</document>
latest9.6/hec/samples/trax/b3.out
1
<?xml version="1.0" encoding="UTF-8"?><document>b</document>
latest9.6/hec/samples/trax/c4.out
1
<?xml version="1.0" encoding="UTF-8"?><document>c</document>
latest9.6/hec/samples/trax/doc1.out
1
<?xml version="1.0" encoding="UTF-8"?><document>
2

  
3

  
4

  
5
</document>
latest9.6/hec/samples/trax/exampleSimple2.out
1
<?xml version="1.0" encoding="iso-8859-1"?><?xml-stylesheet type="text/xsl" href="../xsl/foo.xsl" title="default-stylesheet"?><foo:document xmlns:foo="http://apache.org/foo" xmlns:bar="http://apache.org/bar" file-name="test" file-path="work" creation-date="971255692078">
2
<bar><param-val>default param value, text from my-var in inc2.xsl</param-val><data>MyBar</data></bar>
3
</foo:document>
latest9.6/hec/samples/trax/xml/baz.xml
1
<?xml version='1.0'?>
2
<foo:document 
3
		  xmlns:foo="http://apache.org/foo"
4
		  xmlns:bar="http://apache.org/bar">
5
<bar:element>MyBaz</bar:element>
6
</foo:document>
latest9.6/hec/samples/trax/xml/cities.xml
1
<?xml version='1.0' encoding="iso-8859-1"?>
2
<cities>
3
  <city name="Paris" country="France">Bonjour</city>
4
  <city name="Madrid" country="Spain">Hola!</city>
5
  <city name="Vienna" country="Austria">Gr?? Gott</city>
6
  <city name="Helsinki" country="Finland">Hyv?? p?iv??</city>
7
  <city name="Rome" country="Italy">Ciao</city>
8
  <town name="Reading" country="England">Hi</town>
9
</cities>
latest9.6/hec/samples/trax/xml/embedded.xml
1
<?xml version='1.0'?>
2
<!DOCTYPE foo:document [
3
  <!ATTLIST xsl:stylesheet id ID #IMPLIED>
4
]>
5
<?xml-stylesheet type="text/xsl" href="#xsl"?>
6
<foo:document 
7
		  xmlns:foo="http://apache.org/foo"
8
		  xmlns:bar="http://apache.org/bar"
9
		  file-name="test"
10
         file-path="work"
11
		  creation-date="971255692078">
12
<bar:element>MyBar</bar:element>
13
<xsl:stylesheet 
14
   id="xsl"
15
   xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
16
   exclude-result-prefixes="foo" 
17
   version='1.0'>
18
      <xsl:template match="/">
19
        <embedded>
20
        <xsl:copy-of select="//bar:element"/>
21
        </embedded>
22
      </xsl:template>
23
</xsl:stylesheet>
24
</foo:document>
latest9.6/hec/samples/trax/xml/foo.xml
1
<?xml version='1.0'?>
2
<?xml-stylesheet type="text/xsl" href="../xsl/foo.xsl" title="default-stylesheet"?>
3
<foo:document 
4
		  xmlns:foo="http://apache.org/foo"
5
		  xmlns:bar="http://apache.org/bar"
6
		  file-name="test"
7
         file-path="work"
8
		  creation-date="971255692078">
9
<bar:element>MyBar</bar:element>
10
</foo:document>
latest9.6/hec/samples/trax/xml/misc.txt
1
<misc>Miscellaneous entity content</misc>
latest9.6/hec/samples/trax/xml/subdir1/foo2.xml
1
<?xml version='1.0'?>
2
<doc>text in foo2.xml</doc>
latest9.6/hec/samples/trax/xml/subdir1/subdir2/foo3.xml
1
<?xml version='1.0'?>
2
<doc>text in foo3.xml</doc>
latest9.6/hec/samples/trax/xml/withentityref.xml
1
<?xml version='1.0'?>
2
<!DOCTYPE foo:document [
3
<!ENTITY misc SYSTEM "misc.txt">
4
]>
5
<foo:document 
6
		  xmlns:foo="http://apache.org/foo"
7
		  xmlns:bar="http://apache.org/bar"
8
		  file-name="test"
9
         file-path="work"
10
		  creation-date="971255692078">
11
<bar:element>MyBar</bar:element>
12
&misc;
13
</foo:document>
latest9.6/hec/samples/trax/xsl/baz.xsl
1
<xsl:stylesheet 
2
      xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='2.0'>
3
    
4
  <!-- same as foo.xsl but doesn't include the param because of a bug -->  
5
  <xsl:template match="/">
6
    <out>
7
      <xsl:apply-templates/>
8
    </out>
9
  </xsl:template>
10
      
11
  <xsl:template 
12
      match="@*|*|text()|processing-instruction()">
13
    <xsl:copy>
14
      <xsl:apply-templates 
15
         select="@*|*|text()|processing-instruction()"/>
16
    </xsl:copy>
17
  </xsl:template>
18
</xsl:stylesheet>
latest9.6/hec/samples/trax/xsl/err.xsl
1
<xsl:stylesheet 
2
      xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='2.0'
3
      xmlns:bar="http://apache.org/bar"
4
      exclude-result-prefixes="bar"
5
      >
6
      
7
  <xsl:include href="inc1/inc1.xsl"/>
8
      
9
  <xsl:param name="a-param">default param value</xsl:param>
10

  
11
  <xsl:output encoding="iso-8859-1"/>
12
  
13
  <xsl:template match="/">
14
    <xsl:comment><xsl:value-of select="system-property('xsl:product-version')"/></xsl:comment>
15
    <xsl:next-match/>
16
  </xsl:template>  
17
  
18
  <xsl:template match="bar:element">
19
    <bar>
20
      <param-val>
21
        <xsl:value-of /><xsl:text>, </xsl:text>
22
        <xsl:value-of select="$my-var"/>
23
      </param-val>
24
      <data><xsl:apply-templates/></data>
25
    </bar>
26
  </xsl:template>
27
      
28
  <xsl:template 
29
      match="@*|*|text()|processing-instruction()">
30
    <xsl:copy>
31
      <xsl:apply-templates 
32
         select="@*|*|text()|processing-instruction()"/>
33
    </xsl:copy>
34
  </xsl:template>
35
</xsl:stylesheet>
latest9.6/hec/samples/trax/xsl/foo.xsl
1
<xsl:stylesheet 
2
      xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='2.0'
3
      xmlns:bar="http://apache.org/bar"
4
      exclude-result-prefixes="bar"
5
      >
6
      
7
  <xsl:include href="inc1/inc1.xsl"/>
8
      
9
  <xsl:param name="a-param">default param value</xsl:param>
10

  
11
  <xsl:output encoding="iso-8859-1"/>
12
  
13
  <xsl:template match="/">
14
    <xsl:comment><xsl:value-of select="system-property('xsl:product-version')"/></xsl:comment>
15
    <xsl:next-match/>
16
  </xsl:template>  
17
  
18
  <xsl:template match="bar:element">
19
    <bar>
20
      <param-val>
21
        <xsl:value-of select="$a-param"/><xsl:text>, </xsl:text>
22
        <xsl:value-of select="$my-var"/>
23
      </param-val>
24
      <data><xsl:apply-templates/></data>
25
    </bar>
26
  </xsl:template>
27
      
28
  <xsl:template 
29
      match="@*|*|text()|processing-instruction()">
30
    <xsl:copy>
31
      <xsl:apply-templates 
32
         select="@*|*|text()|processing-instruction()"/>
33
    </xsl:copy>
34
  </xsl:template>
35
</xsl:stylesheet>
latest9.6/hec/samples/trax/xsl/foo2.xsl
1
<?xml version="1.0"?> 
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
3
                xmlns:bar="http://apache.org/bar">
4
  
5
  <xsl:template match="bar">
6
    <out>
7
      <xsl:value-of select="."/>
8
    </out>
9
  </xsl:template>
10
  
11
  <xsl:template match="text()">
12
  </xsl:template>  
13
 
14
</xsl:stylesheet>
latest9.6/hec/samples/trax/xsl/foo3.xsl
1
<?xml version="1.0"?> 
2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
3
  
4
  <xsl:template match="out">
5
    <out>
6
      <xsl:apply-templates/>
7
    </out>
8
  </xsl:template>
9
  
10
  <xsl:template match="text()">
11
    <some-text><xsl:value-of select="."/></some-text>
12
  </xsl:template>  
13
   
14
</xsl:stylesheet>
latest9.6/hec/samples/trax/xsl/identity.xsl
1
<xsl:stylesheet 
2
      xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='2.0'>
3

  
4

  
5
  <xsl:template match="*">
6
    <xsl:copy>
7
      <xsl:copy-of select="@*"/>
8
      <xsl:apply-templates/>
9
    </xsl:copy>
10
  </xsl:template>
11
      
12
</xsl:stylesheet>
latest9.6/hec/samples/trax/xsl/inc1/inc1.xsl
1
<xsl:stylesheet 
2
      xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
3
      
4
  <xsl:include href="inc2/inc2.xsl"/>
5
  
6
</xsl:stylesheet>
latest9.6/hec/samples/trax/xsl/inc1/inc2/inc2.xsl
1
<xsl:stylesheet 
2
      xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='2.0'>
3
  <xsl:variable name="my-var" select="'text from my-var in inc2.xsl'"/>
4
</xsl:stylesheet>
latest9.6/hec/samples/trax/xsl/multidoc.xsl
1
<xsl:stylesheet 
2
      xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='2.0'
3
      xmlns:date="java:java.util.Date"
4
      exclude-result-prefixes="date">
5

  
6
<!-- this stylesheet tests multi-document output by creating a new result document for each element -->
7

  
8
  <xsl:template match="/">
9
  <output>
10
    <xsl:attribute name="at" select="date:toString(date:new())" use-when="function-available('date:new', 0)"/>
11
    <xsl:apply-templates select="cities/*"/>
12
  </output>
13
  </xsl:template>  
14

  
15
  <xsl:template match="city">
16
    <xsl:result-document href="{@name}.out" encoding="iso-8859-1">
17
      <document>
18
         <xsl:copy-of select="@*"/>
19
         <xsl:apply-templates/>
20
      </document>
21
    </xsl:result-document>
22
  </xsl:template>
23
  
24
  <xsl:template match="town">
25
    <xsl:result-document href="{@name}.sax">
26
      <document>
27
         <xsl:copy-of select="@*"/>
28
         <xsl:apply-templates/>
29
      </document>
30
    </xsl:result-document>
31
  </xsl:template>  
32
      
33
</xsl:stylesheet>
latest9.6/hec/samples/trax/xsl/postamble.txt
1
This is the content of the postamble
latest9.6/hec/samples/trax/xsl/preamble.txt
1
This is the content of the preamble
latest9.6/hec/samples/trax/xsl/text.xsl
1
<!DOCTYPE xsl:stylesheet [
2
<!ENTITY postamble SYSTEM "postamble.txt">
3
]>
4
<xsl:stylesheet 
5
      xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='2.0'>
6
    
7
  <!-- This stylesheet uses a user-written URI Resolver to load a text file both at compile time and at runtime -->  
8
  <xsl:template match="/">
9
    <out>
10
      <preamble><xsl:value-of select="document('preamble.txt')"/></preamble>
11
      <xsl:copy-of select="."/>
12
      <postamble>&postamble;</postamble>
13
    </out>
14
  </xsl:template>
15
      
16
  <xsl:template 
17
      match="@*|*|text()|processing-instruction()">
18
    <xsl:copy>
19
      <xsl:apply-templates 
20
         select="@*|*|text()|processing-instruction()"/>
21
    </xsl:copy>
22
  </xsl:template>
23
</xsl:stylesheet>
latest9.6/hec/samples/xqueryExamples.php
1
<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
<html xmlns="http://www.w3.org/1999/xhtml">
3
    <head>
4
        <title>Saxon/C API design use cases</title>
5
    </head>
6
    <body>
7
        <?php 
8
            
9
            /* simple example to show transforming to string */
10
            function exampleSimple1($proc, $xmlfile, $queryFile){
11
                $proc->setSourceFile($xmlfile);
12
                $proc->importXQueryFile($queryFile);
13
  	              
14
                $result = $proc->queryToString();               
15
		if($result != null) {               
16
		echo '<b>exampleSimple1:</b><br/>';		
17
		echo 'Output:'.$result;
18
		} else {
19
			echo "Result is null";
20
		}
21
		$proc->clearParameters();
22
		$proc->clearProperties();            
23
            }
24
            
25
            /* simple example to show transforming to file */
26
            function exampleSimple2($proc, $xmlFile, $xslFile){
27
                $proc->setSourceFile($xmlFile);
28
                $proc->importStylesheetFile($xslFile);
29
                $filename = "out/output1.xml";
30
                $proc->transformToFile($filename);
31
		echo '<b>exampleSimple2:</b><br/>';		
32
		if (file_exists($filename)) {
33
		    echo "The file $filename exists";
34
		} else {
35
		    echo "The file $filename does not exist";
36
		}
37
       		$proc->clearParameters();
38
		$proc->clearProperties();
39
            }
40
            /* simple example to show importing a document as string and stylesheet as a string */
41
            function exampleSimple3($proc){
42
		$proc->clearParameters();
43
		$proc->clearProperties();
44
                $xdmNode = $proc->parseString("<doc><b>text value of out</b></doc>");
45
		if($xdmNode == null) {
46
			echo 'xdmNode is null';
47
			return;	
48
		}            
49
		$proc->setSourceValue($xdmNode);
50
                $proc->importStylesheetString("<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='2.0'>
51
					    	<xsl:template match='/'>
52
					    	    <xsl:copy-of select='.'/>
53
					    	</xsl:template>
54
					    </xsl:stylesheet>");
55

  
56
                $result = $proc->transformToString();
57
		echo '<b>exampleSimple3</b>:<br/>';
58
		if($result != null) {             		
59
		echo 'Output:'.$result;
60
		} else {
61
			echo "Result is null";
62
		}       
63
		$proc->clearParameters();
64
		$proc->clearProperties();            
65
            }
66

  
67

  
68
           
69
           
70
            function exampleParam($proc, $xmlFile, $xslFile){
71
                echo '<b>ExampleParam:</b><br/>';
72
                $proc->setSourceFile($xmlFile);
73
                $proc->importStylesheetFile($xslFile);
74
		$xdmvalue = $proc->createXdmValue(strval("Hello to you"));
75
		if($xdmvalue !=null){
76
			echo "Name of Class " , get_class($xdmvalue) , "\n"; 			
77
			/*$str = $xdmvalue->getStringValue();
78
			if($str!=null) {
79
				echo "XdmValue:".$str;
80
			} */
81
			$proc->setParameter("", 'a-param', $xdmvalue);
82
		} else {
83
			echo "Xdmvalue is null";
84
		}
85
                $result = $proc->transformToString();
86
		if($result != null) {                
87
			echo 'Output:'.$result."<br/>";
88
		} else {
89
			echo "Result is NULL<br/>";
90
		}
91
                //$par1 = $proc->getParameter('a-param'); //TODO there is a bug in this method
92
                if($par1 != NULL) {
93
                    echo 'Parameter exists';
94
                }
95
                //unset($par1);
96
                $proc->clearParameters();                
97
                //unset($result);
98
                echo 'again with a no parameter value<br/>';
99
		$proc->setProperty('!indent', 'yes'); //Serialization property indicated with a '!' symbol
100
                $result = $proc->transformToString();
101
                /*$prop1 = $proc->getProperty('!indent'); //TODO there is a bug in this method
102
                if($prop1 != NULL) {
103
                    echo 'getProperty = '.$prop1;
104
                }*/
105
                $proc->clearProperties();
106
                echo $result;
107
                echo '<br/>';
108
              //  unset($result);
109
                echo 'again with no parameter and no properties value set<br/>';
110
                $xdmvalue = $proc->createXdmValue(strval("goodbye to you"));
111
		$proc->setParameter('a-param', $xdmvalue);
112
                $result = $proc->transformToString();                
113
                echo $result;
114
		$proc->clearParameters();
115
		$proc->clearProperties(); 
116
                        
117
            }
118

  
119

  
120
            function exampleXMLFilterChain($proc, $xmlFile, $xsl1File, $xsl2File, $xsl3File){
121
                echo '<b>XML Filter Chain using setSource</b><br/>';                
122
                $proc->setSourceFile($xmlFile);
123
                $proc->importStylesheetFile($xsl1File);
124
                $xdmValue1 = $proc->transformToValue();
125
                
126
                $proc->importStylesheetFile($xsl2File);
127
                $proc->setSourceValue($xdmValue1);
128
                unset($xdmValue1);
129
                $xdmValue1 = $proc->transformToValue();
130
                
131
                $proc->importStylesheetFile($xsl3File);                
132
                $proc->setSourceValue($xdmValue1);
133
                $result = $proc->transformToString();
134
		if($result != null) {
135
                	echo 'Output:'.$result;        
136
		} else {
137
			echo 'Result is null';
138
				    $errCount = $proc->getExceptionCount();
139
				    if($errCount > 0 ){ 
140
				        for($i = 0; $i < $errCount; $i++) {
141
					       $errCode = $proc->getErrorCode(intval($i));
142
					       $errMessage = $proc->getErrorMessage(intval($i));
143
					       echo 'Expected error: Code='.$errCode.' Message='.$errMessage;
144
					   }
145
						$proc->exceptionClear();	
146
					}
147
		}                      
148
		$proc->clearParameters();
149
		$proc->clearProperties();
150
            }
151
            
152
            function exampleXMLFilterChain2($proc, $xmlFile, $xsl1File, $xsl2File, $xsl3File){
153
                echo '<b>XML Filter Chain using Parameters</b><br/>';                
154
                $xdmNode = $proc->parseFile($xmlFile);
155
                $proc->setParameter('s', $xdmNode);
156
                $proc->importStylesheetFile($xsl1File);
157
                $xdmValue1 = $proc->transformToValue();
158
                $proc->clearParameters();
159
                
160
                $proc->importStylesheetFile($xsl2File);
161
                $proc->setParameter('s',$xdmValue1);
162
                $xdmValue1 = $proc->transformToValue();
163
                $proc->clearParameters();
164
                
165
                $proc->importStylesheetFile($xsl3File);                
166
                $proc->setParameter('s', $xdmValue1);
167
                $result = $proc->transformToString();
168
		if($result != null) {
169
                	echo 'Output:'.$result;        
170
		} else {
171
			echo 'Result is null';
172
				    $errCount = $proc->getExceptionCount();
173
				    if($errCount > 0 ){ 
174
				        for($i = 0; $i < $errCount; $i++) {
175
					       $errCode = $proc->getErrorCode(intval($i));
176
					       $errMessage = $proc->getErrorMessage(intval($i));
177
					       echo 'Expected error: Code='.$errCode.' Message='.$errMessage;
178
					   }
179
						$proc->exceptionClear();	
180
					}
181
		}        
182
		$proc->clearParameters();
183
		$proc->clearProperties();
184
            }            
185

  
186
            /* simple example to detect and handle errors from a transformation */
187
            function exampleError1($proc, $xmlfile, $xslFile){
188
		echo '<b>exampleError1:</b><br/>';
189
                $proc->setSourceFile($xmlFile);
190
                $proc->importStylesheetFile($xslFile);
191
                
192
                $result = $proc->transformToString();
193
                
194
                if($result == NULL) {
195
                    $errCount = $proc->getExceptionCount();
196
				    if($errCount > 0 ){ 
197
				        for($i = 0; $i < $errCount; $i++) {
198
					       $errCode = $proc->getErrorCode(intval($i));
199
					       $errMessage = $proc->getErrorMessage(intval($i));
200
					       echo 'Expected error: Code='.$errCode.' Message='.$errMessage;
201
					   }
202
						$proc->exceptionClear();	
203
					}
204
                
205
                
206
                }                
207
                echo $result;
208
            	$proc->clearParameters();
209
		$proc->clearProperties();
210
            
211
            }   
212

  
213

  
214
            /* simple example to test transforming without an stylesheet */
215
            function exampleError2($proc, $xmlfile, $xslFile){
216
		echo '<b>exampleError2:</b><br/>';
217
                $proc->setSourceFile($xmlFile);
218
                $proc->importStylesheetFile($xslFile);
219
                
220
                $result = $proc->transformToString();
221
                
222
                if($result == NULL) {
223
                    $errCount = $proc->getExceptionCount();
224
				    if($errCount > 0 ){ 
225
				        for($i = 0; $i < $errCount; $i++) {
226
					       $errCode = $proc->getErrorCode(intval($i));
227
					       $errMessage = $proc->getErrorMessage(intval($i));
228
					       echo 'Expected error: Code='.$errCode.' Message='.$errMessage;
229
					   }
230
						$proc->exceptionClear();	
231
					}
232
                
233
                
234
                }                
235
                echo $result;            
236
           	$proc->clearParameters();
237
		$proc->clearProperties();
238
            
239
            }   
240
            
241
            
242
            $books_xml = "xml/books.xml";
243
            $books_to_html_xq = "query/books-to-html.xq";
244
            $baz_xml = "xml/baz.xml";
245
            $baz_xsl = "xsl/baz.xsl";
246
            $foo2_xsl = "xsl/foo2.xsl";
247
            $foo3_xsl = "xsl/foo3.xsl";
248
            $err_xsl = "xsl/err.xsl";            
249
            $err1_xsl = "xsl/err1.xsl";
250
            $text_xsl = "xsl/text.xsl";
251
            $cities_xml = "xml/cities.xml";
252
            $embedded_xml = "xml/embedded.xml";
253
            $multidoc_xsl = "xsl/multidoc.xsl";
254
            $identity_xsl = "xsl/identity.xsl"; 
255
            
256
            $proc = new SaxonProcessor();
257
		
258
		
259
            $version = $proc->version();
260
   	    echo '<b>PHP XQuery examples</b><br/>';
261
            echo 'Saxon Processor version: '.$version;
262
            echo '<br/>';        
263
            exampleSimple1($proc, $books_xml, $books_to_html_xq);
264
/*            echo '<br/>';
265
            exampleSimple2($proc, "xml/foo.xml", $foo_xsl);
266
            echo '<br/>';            
267
            exampleSimple3($proc);
268
            echo '<br/>';
269
            exampleParam($proc, $foo_xml, $foo_xsl);
270
            exampleError1($proc, $foo_xml, $err_xsl);
271
            echo '<br/>'; 
272
	    exampleError2($proc, $foo_xml, $err1_xsl);
273
            echo '<br/>';
274
            exampleXMLFilterChain($proc, $foo_xml, $foo_xsl, $foo2_xsl, $foo3_xsl);
275
            echo '<br/>';                    
276
            exampleXMLFilterChain2($proc, $foo_xml, $foo_xsl, $foo2_xsl, $foo3_xsl);          
277
            echo '<br/>'; */ 
278

  
279
//	    $proc->close();            
280
            unset($proc);
281
	
282
        
283
        ?>
284
    </body>
285
</html>
latest9.6/hec/samples/xslt30TestSuite.php
1
<?php 
2
/*error_reporting(E_ALL|E_STRICT);
3
ini_set('display_errors', 'on');*/
4
ini_set('max_execution_time', 300);
5
$root=pathinfo($_SERVER['SCRIPT_FILENAME']);
6
define ('BASE_FOLDER', basename($root['dirname']));
7
define ('SITE_ROOT',    realpath(dirname(__FILE__)));
8
define ('SITE_URL',    'http://'.$_SERVER['HTTP_HOST'].'/'.BASE_FOLDER);
9

  
10

  
11
echo 'BASE_FOLDER'. basename($root['dirname']);
12
echo '<br/>';
13
echo 'SITE_ROOT'.    realpath(dirname(__FILE__));
14
echo '<br/>';
15
echo 'SITE_URL'.    'http://'.$_SERVER['HTTP_HOST'].'/'.BASE_FOLDER;
16
echo '<br/>';
17

  
18

  
19
 $saved = getenv("LD_LIBRARY_PATH");        // save old value
20
 $newld = "/usr/local/jet9.0-pro-x86/lib/x86/shared";  // extra paths to add
21
 if ($saved) { $newld .= ":$saved"; }           // append old paths if any
22
 putenv("LD_LIBRARY_PATH=$newld");        // set new value
23

  
24
                        // mycommand is loaded using
25
                        // libs in the new path list
26
 putenv("LD_LIBRARY_PATH=$saved");  
27

  
28
 $saved = getenv("PATH");        // save old value
29
 $newld = "/usr/local/jet9.0-pro-x86/bin:/usr/local/jet9.0-pro-x86/profile1.7.0_40/jre";  // extra paths to add
30
 if ($saved) { $newld .= ":$saved"; }           // append old paths if any
31
putenv("PATH=$newld");        // set new value
32
 
33
                        // mycommand is loaded using
34
                        // libs in the new path list
35
 //putenv("PATH=$saved"); 
36
//phpinfo();
37

  
38

  
39

  
40
$path = "xslt30-test/";
41
$catalog = $path."catalog.xml";
42
$saxon_version = "";
43

  
44
$proc = new SaxonProcessor();
45
$start = microtime(true);
46
              $proc->setSourceFile("cat.xml");
47
                $proc->importStylesheetFile("test.xsl");
48
                $result = $proc->transformToValue();
49
 $end = microtime(true);
50

  
51

  
52
    echo "Time : " . ($end-$start) . "s\n";
53
if($result == NULL) {
54
                      $errCount = $proc->getExceptionCount();
55
       echo $errCount;    
56
if($errCount>0){ 
57
                      echo 'Error: '.$proc->getErrorMessage(0)." code:".$proc->getErrorCode(0);        
58
                           }
59
    
60
   } else {
61
echo $result;
62
}
63
//$proc->clear();
64
//$proc->close();
65

  
66

  
67
function test_set_files ($catalog){ 
68
	
69
	$array = array();  
70
	$attName;
71
	$attFile;
72
	if (file_exists($catalog)) {
73
    	  $xml = simplexml_load_file($catalog);
74
    	  foreach ($xml->{'test-set'} as $value) {
75
//	echo "________________".$value->attributes()->name."_________".$value->attributes()->file;
76
	$attName = $value->attributes()->name;
77
	$attFile = $value->attributes()->file;
78
	$array["".$attName] = $attFile;	
79
      }	
80
      } else {
81
        exit('Failed to open '.$catalog);
82
      }
83
   return $array;
84
}
85

  
86
function check_dependency($xml){
87
	foreach ($xml->children() as $child)
88
	{
89
	  $var1 = $child->getName();
90
	  switch($var1) {
91
	    case "feature":
92
		return false;
93
	    case "spec":
94
		if(strpos($child->attributes()->{'value'},"XSLT30")!== false){
95
			return false;			
96
		}
97
	  }
98
	}
99
	return true;
100
}
101

  
102
function parse_environment($xml, $path){
103
	$array = array();
104
    	  foreach ($xml->{'environment'} as $value) {
105
		$envName = $value->attributes()->name;
106
		$source = $value->{'source'};
107
		if($source->attributes()->file and !($source->attributes()->validation)) {
108
		//  echo $path.$source->attributes()->file." ";
109
		  $array["".$envName] = $path.$source->attributes()->file;
110
		}
111
      	  }
112
	echo "<br/>";
113
	echo "<br/>";
114
	return $array;
115
} 
116

  
117
function test_case($test_set) {
118
	$env;
119
	$xml;
120
	$test_path = pathinfo($test_set)['dirname']."/";
121
	echo $test_path;
122
	if (file_exists($test_set)) {
123
    	  $xml = simplexml_load_file($test_set);
124
	  $env = parse_environment($xml, $test_path);
125
echo "<table border='1' style='width:60%'>
126
<tr>
127
  <th>Test Case Name </th>
128
  <th style='width:80%'>Result </th>
129
</tr>";
130

  
131
$check = check_dependency($xml->dependencies);
132
if($check){
133
	  foreach($xml->{'test-case'} as $value){
134
		$testCaseName = $value->attributes()->name;
135
		echo "<tr><td>$testCaseName</td>";
136
		$result = run_test_case($value, $env, $test_path);
137
		echo "<td>".$result."</td>";
138
		echo "</tr>";
139
	 	//$test = $value->{'test'}->{'stylesheet'};
140
		//echo "____test:".$test_path."tests".$test->attributes()->file;
141
	  }
142
}else {
143
echo "<tr><td>No tests run</td><td></td></tr>";
144
}
145
echo "</table>";
146
		
147
      } else {
148
        exit('Failed to open '.$test_set);
149
      }	
150
}
151

  
152
function run_test_case($testcase, $env, $path){
153
	global $proc;
154
	$errorTest = FALSE;
155
	$t_env = $testcase->{'environment'};
156
	$testDirValue = new XdmValue(strval($path));
157
	$t_env_ref = $t_env->attributes()->ref;
158
	$checkDependency = check_dependency($testcase->dependencies);
159
	if($checkDependency){
160
		
161
			$test = $path.$testcase->{'test'}->{'stylesheet'}->attributes()->file;
162
			//echo $test;
163
			if (file_exists($test)) {
164
				try{
165
					if($t_env) {
166
					if($env[$t_env_ref.""]){
167
						$proc->clear();
168
						//error_log("before apply source:".$env[$t_env_ref.""]);
169
						//error_log("before apply stylesheet:".$test);
170
						$init_template = $testcase->{'test'}->{'initial-template'};
171
						if($init_template){
172
							$proc->setProperty('it', strval($testcase->{'test'}->{'initial-template'}->attributes()->{'name'}));
173
						}
174
						$result = $proc->xsltApplyStylesheet($env[$t_env_ref.""], $test);
175
						if($result == NULL) {
176
							echo 'Error: '.$proc->getErrorMessage(0)." code:".$proc->getErrorCode(0);		
177
							$errCount = $proc->getExceptionCount();
178
							$result= "";
179
							if($errCount > 0 ){
180
							$result= "<out>";
181
							  for ($i = 0; $i < $errCount; $i++) {
182
 							    $errC = $proc->getErrorCode(intval(i));
183
							     if($errC != NULL) {
184
							       $result = $result.$errC." ";	
185
							     }
186
							  $result= $result."</out>";
187
						    	  $errorTest = TRUE;
188
							  }
189
							}
190

  
191
													
192
						}
193

  
194
						$asserts= $testcase->{'result'};
195
						$xdmValue = $proc->parseString(strval($asserts->asXML()));
196
						/*if($testcase->attributes()->{'name'}=='import-0502b'){
197
						 	echo "result:".$result;
198
						 	echo "assert:".($asserts->asXML());
199
							exit('import-0502b');					
200
						}*/
201
						if($xdmValue == NULL){
202
							error_log("NULL FOUND IN ASSERT");
203
							if($proc->getExceptionCount() > 0){
204
								error_log(" assert exception: ".$proc->getErrorMessage(0));
205
								return "NO ASSERTION".($asserts->asXML());
206
							}
207

  
208
						}
209
						$proc->setParameter('', 'assertion', $xdmValue);
210
						error_log("before result : ");
211
						$resulti  = $proc->parseString(''.$result);
212
						if($resulti== NULL) {	
213
							error_log(" assert exception: ".$proc->getErrorMessage(0));
214
							return "NULL result";
215
						}									
216
						$proc->setParameter('', 'result', $resulti);
217
						$proc->setParameter('', 'testDir', $testDirValue);
218
						$proc->setProperty('it', 'main');
219
						$proc->exceptionClear();
220
						$outcome = $proc->xsltApplyStylesheet1("TestOutcome.xsl");
221
						$proc->clear();
222
						if($outcome==NULL){
223
							error_log("Assert:".($asserts->asXML()));
224
							echo "Assert:".($asserts->asXML());
225
							echo "Assert:".($result);
226
							$errCount = $proc->getExceptionCount();
227
							error_log("Error Count".$errCount);
228
							if($errCount > 0 ){
229

  
230
							$result= "<out>";
231
							  for ($i = 0; $i < $errCount; $i++) {
232
 							    $errC = $proc->getErrorMessage(intval(i));
233
							     if($errC != NULL) {
234
							       $result = $result.$errC." ";	
235
							     }
236
						    	  $errorTest = TRUE;
237
							  $result= $result."</out>";
238
							  }
239

  
240
							echo "Error count: ".$errCount.", ". ($result);
241
							}
242
							return "false";						
243
						}
244
						if($errorTest){
245
							return 'assert-Error: '.$outcome;						
246
						}
247
						$proc->clear();
248
						return $outcome;						
249
					}else {
250
						return 	$t_env_ref." not found";				
251
					}
252
					} else { 
253
						$proc->clear();
254
						$proc->exceptionClear();
255
						$init_template = $testcase->{'test'}->{'initial-template'};
256
						if($init_template){
257
							$proc->setProperty('it', strval($testcase->{'test'}->{'initial-template'}->attributes()->{'name'}));
258
						}
259
						$result = $proc->transformToString($test);
260
						if($result == NULL) {
261
							
262
							$errCount = $proc->getExceptionCount();
263
							$result= "";
264
							if($errCount > 0 ){
265
							$result= "<out>";
266
							  for ($i = 0; $i < $errCount; $i++) {
267
 							    $errC = $proc->getErrorCode(intval(i));
268
							     if($errC != NULL) {
269
							       $result = $result.$errC." ";	
270
							     }
271
							  $result= $result."</out>";
272
							  }
273
							}
274

  
275
													
276
						}
277
						$asserts= $testcase->{'result'};
278
						$xdmValue = $proc->parseString(''.$asserts->asXML());
279
						/*if($testcase->attributes()->{'name'}=='import-0502b'){
280
						 	echo "result:".$result;
281
						 	echo "assert:".($asserts->asXML());
282
							exit('import-0502b');					
283
						}*/
284
						if($xdmValue == NULL){	
285
								error_log(" assert exception: ".$proc->getErrorMessage(0));
286
								return "NO ASSERTION";
287
						}					
288
						$proc->setParameter('', 'assertion', $xdmValue);
289
						$resulti  = $proc->parseString(''.$result);
290
						if($resulti== NULL) {
291
							return "NULL result";		
292
						}
293
						$proc->setParameter('', 'result', $resulti);
294
						$proc->setParameter('', 'testDir',$testDirValue);
295
						$proc->setProperty('it', 'main');
296
						$outcome = $proc->transformToString("TestOutcome.xsl");
297
						$proc->clear();
298
						if($outcome==NULL){
299
							echo "Assert:".($asserts->asXML());
300
							$errCount = $proc->getExceptionCount();
301
							if($errCount > 0 ){
302
							$result= "<out>";
303
							  for ($i = 0; $i < $errCount; $i++) {
304
 							    $errC = $proc->getErrorMessage(intval(i));
305
							     if($errC != NULL) {
306
							       $result = $result.$errC." ";	
307
							     }
308
							  $result= $result."</out>";
309
							  }
310

  
311
							echo "Error count: ".$errCount.", ". ($result);
312
							}
313
							return "false";						
314
						}
315
						$proc->clear();
316
						if($outcome== FALSE){
317
							$resulti = '|| Assertion: '.($asserts->asXML()).'|||| result: '.$resulti.' ||| ';
318
							return 'assert-Error: '.$outcome;						
319
						}
320
						
321
						return $outcome.'';
322
					
323
					}
324
				}catch(Exception $ex){
325
					return "Fail - error: ".$ex->getMessage();			
326
				}
327
			return "Fail";			
328
			} else {
329
				return $test." not found";			
330
			}		
331
							
332
	}
333

  
334
	return "Not Run";
335
}
336

  
337

  
338
$saxon_version = $proc->version();
339
echo "<a name='top'></a>";
340
echo "<h1>W3 XSLT 3.0 Test Suite</h1>
341
<h4>(PHP Test Harness. Version: 1.0. Saxon c++ plugin, Saxon product version: $saxon_version)</h4>
342
<br/>";
343
$testFiles = test_set_files($catalog);
344
echo "<b>Test sets: ".count($testFiles)."<b/>";
345
echo "<table border='1'>
346
<tr>
347
  <th>Test Name </th>
348
  <th>File Name </th>
349
  <th> #Test cases </th>
350
</tr>";
351

  
352
foreach ($testFiles as $key => $test_set) {
353
 $testSet_xml = simplexml_load_file("xslt30-test/".$test_set);
354
echo "<tr>";
355
	echo "<td><a href='#".$key."'>".$key . "</a></td>";
356
	echo "<td>".$test_set."</td>";
357
	echo "<td>".count($testSet_xml->{'test-case'})."</td>";
358
echo "</tr>";
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff