amiro       01/09/05 12:03:34

  Added:       test/tests/contrib/xsltc/schemasoft SQLjoin.xml SQLjoin.xsl
                        XMLSchema2cplusplus.xml XMLSchema2cplusplus.xsl
                        attributes2elements.xml attributes2elements.xsl
                        bottles.xml bottles.xsl calendar.xml calendar.xsl
                        differentiate.xml differentiate.xsl
                        eratosthenes.xml eratosthenes.xsl factorial.xml
                        factorial.xsl log10.xml log10.xsl pi.xml pi.xsl
                        queryOnSubElement.xml queryOnSubElement.xsl
                        selectHREF.xml selectHREF.xsl
                        suppressEmptyElements.xml suppressEmptyElements.xsl
  Log:
  Tests submitted by John Howard from Schemasoft. Some of them have
  been used in performance benchmarks. They are not atomic conformance
  test, but are designed to really give an XSLT processor a workout.
  
  Revision  Changes    Path
  1.1                  xml-xalan/test/tests/contrib/xsltc/schemasoft/SQLjoin.xml
  
  Index: SQLjoin.xml
  ===================================================================
  <DB>
  <orders customer_id="c1">
   <product>my_reference</product>
  </orders>
  <orders customer_id="c3">
   <product>my_reference 2</product>
  </orders>
  <customer id="c1">
   <name>Dupont</name>
  </customer>
  </DB>
  
  
  
  1.1                  xml-xalan/test/tests/contrib/xsltc/schemasoft/SQLjoin.xsl
  
  Index: SQLjoin.xsl
  ===================================================================
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                   version="1.0" >
  <!-- SQL ================
  select orders.*, customers.name from orders, customers
  where orders.customer_id = customers.id
  and orders.product = "my_reference"
   XSLT  ================ 
  -->
  <xsl:template match='/'>
  <root>
   <xsl:apply-templates/>
  </root>
  </xsl:template>
  
  <xsl:template match='customer' > </xsl:template>
  <xsl:template match='orders' > </xsl:template>
  
  <xsl:template match='orders[product = "my_reference"]'>
    <xsl:copy>  
     <xsl:apply-templates/>
    </xsl:copy>  
    <xsl:copy-of select="id(@customer_id)"/>
  </xsl:template>
  </xsl:stylesheet>
  
  
  
  1.1                  
xml-xalan/test/tests/contrib/xsltc/schemasoft/XMLSchema2cplusplus.xml
  
  Index: XMLSchema2cplusplus.xml
  ===================================================================
  <?xml version='1.0'?>
  <!-- Commented out for IE5 which doesn't understand :
  <!DOCTYPE schema SYSTEM 
"http://www.w3.org/TR/2000/WD-xmlschema-1-20000225/structures.dtd"; >
  --> 
  
  <!-- Uncomment to format with CSS: <?xml-stylesheet href="limits-mess.css" 
type="text/css"?> -->
  
  <messagesList xmlns='urn:bigtrust:bizmess:limits:V0.0'>
  
  <schema targetNS='urn:bigtrust:bizmess:limits:V0.0' version="M.n" 
    xmlns="http://www.w3.org/1999/XMLSchema"; 
    xmlns:bm="urn:bigtrust:bizmess:limits:V0.0"
    xmlns:html="html" >
  
   <documentation xmlns:dc="http://www.w3.org/TR/1999/PR-rdf-schema-19990303#"; >
  
  <html:p>Definition of limit messages for bizmess</html:p>
  
  A message of bizmess is simply a list of fields, a field being essentially a 
pair name-value. For performance across network, the messages are sent in a 
binary form, in form of a pair index-value. Messages sent are constrained by an 
initial list of fields and messages coming from the server (or in a config. 
file). This initial message is itself being defined here. 
  <dc:Author>J.M. Vanel</dc:Author> 
  <dc:date>2000-01-18</dc:date> 
  </documentation>
  
   <!-- Abstract types -->
  
   <complexType name='genericMessage'><documentation>Abstract type for all the 
bizmess messages</documentation></complexType>
   <complexType name='genericField'>
    <documentation>Abstract type for all the fields in bizmess 
messages</documentation>
   </complexType>
  
   <!-- fields -->
  
    <complexType name='InstrumentType' source='genericField' 
derivedBy='extension' type='string' >
     <documentation><html:b>Type of Instrument</html:b> (bond, etc) ... [any 
html content]</documentation>
     <!-- For implementation of binary messages : -->
     <id>0</id>
     <size>32</size>
    </complexType>
  
    <complexType name='CounterParty' source='genericField' 
derivedBy='extension' type='string' >
     <documentation><html:b>Counter-party name</html:b> ... [any html 
content]</documentation>
     <id>1</id>
     <size>64</size>
    </complexType>
  
   <!-- messages -->
  
   <complexType name='enquiry' source='genericMessage' derivedBy='extension'>
    <documentation><html:b>enquiry</html:b> about ... [any html 
content]</documentation>
    <element name='InstrumentType' type='bm:InstrumentType'></element> 
    <element name='CounterParty' type='bm:CounterParty' ></element> 
   </complexType>
  
   <!-- root element -->
   <element name="bizmess">
    <complexType>
     <element type='bm:enquiry' name='enquiry' /> 
     <element name='reference' type='string' /> 
    </complexType>
   </element> 
  </schema>
  </messagesList>
  
  
  
  1.1                  
xml-xalan/test/tests/contrib/xsltc/schemasoft/XMLSchema2cplusplus.xsl
  
  Index: XMLSchema2cplusplus.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <!-- xt sampleXMLSchema.xml XMLSchema2c++.xslt -->
  
  <xsl:stylesheet
   xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
   xmlns:xsch="http://www.w3.org/1999/XMLSchema"; 
                   version="1.0" >
  
  <xsl:output method="text"/>
  
  <xsl:template match  = '/' >
  typedef int integer;
     <xsl:apply-templates/>
  </xsl:template>
  <xsl:template match  = 'text()' >
  </xsl:template>
  
  <xsl:template match="@*|*">
      <xsl:apply-templates />
  </xsl:template>
  
  <xsl:template match = 'xsch:complexType' >
  class <xsl:value-of select="@name"/> 
    <xsl:if test="@derivedBy='extension'" > : public <xsl:value-of 
select="@source"/>
    </xsl:if>
  {
    <xsl:if test="@type" >
      <xsl:value-of select="@type"/> content;
    </xsl:if>
  <xsl:apply-templates/>
  };
  </xsl:template>
  
  <xsl:template match = 'xsch:element' >
  <xsl:variable name="type">
  <xsl:value-of select="@type"/>
  </xsl:variable>
  <xsl:choose>
   <xsl:when test="$type != ''">
    <xsl:value-of select="$type"/>
   </xsl:when>
   <xsl:otherwise>
    no_type_specified 
   </xsl:otherwise>
  </xsl:choose>
  <xsl:text> </xsl:text><xsl:value-of select="@name"/> ;
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  
  1.1                  
xml-xalan/test/tests/contrib/xsltc/schemasoft/attributes2elements.xml
  
  Index: attributes2elements.xml
  ===================================================================
  <a>
   <b href="hrefIn_b-1rstLevel">b content,
    <d>d in b,</d>
   </b>
   <c>
    <d>d in c,</d>
    <g href="hrefIn_g-2ndLevel">g content,</g>
   </c>
   <e> </e>
   <f>f content,
     <g>g in f,
     <d>d in f/g,
      </d> </g> </f>
  </a>
  
  
  
  
  1.1                  
xml-xalan/test/tests/contrib/xsltc/schemasoft/attributes2elements.xsl
  
  Index: attributes2elements.xsl
  ===================================================================
  <?xml version="1.0"?>
  <!-- Replace attributes with elements.
       Note that the reverse transform is not possible.
  
  Copyright J.M. Vanel 2000 - under GNU public licence 
  xt testHREF.xml attributes2elements.xslt > attributes2elements.xml
  
   -->
  
  <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
                  version="1.0" >
  
   <xsl:template match ="@*" >
     <xsl:element name='{name()}'>
      <xsl:value-of select='.' />
     </xsl:element>
   </xsl:template>
  
   <xsl:template match="*">
    <xsl:copy>
      <xsl:apply-templates select="*|@*" />
    </xsl:copy>
   </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  
  
  1.1                  xml-xalan/test/tests/contrib/xsltc/schemasoft/bottles.xml
  
  Index: bottles.xml
  ===================================================================
  <?xml version="1.0"?>
  <!--
       File:       bottles.xml
       Purpose:    XSL Version of 99 Bottles of Beer
       Author:     Chris Rathman 1/10/2001
       Desc:       XML file used to define parameter constants
       Tested:     Xalan Version 1.1 and Saxon 5.4.1
  -->
  <?xml-stylesheet type="text/xsl" href="bottles.xsl"?>
  <bottles>
  <quantity>99</quantity>
  <container-plural>bottles</container-plural>
  <container-singular>bottle</container-singular>
  <item>beer</item>
  <location>on the wall</location>
  <retrieve>You take one down</retrieve>
  <distribute>pass it around</distribute>
  </bottles>
  
  
  
  1.1                  xml-xalan/test/tests/contrib/xsltc/schemasoft/bottles.xsl
  
  Index: bottles.xsl
  ===================================================================
  <?xml version="1.0"?>
  <!--
       File:       bottles.xsl
       Purpose:    XSL Version of 99 Bottles of Beer
       Author:     Chris Rathman 1/10/2001
       Desc:       Transform bottles.xml into output text stream
       Tested:     Xalan Version 1.1 and Saxon 5.4.1
  -->
  <xsl:stylesheet
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
     version="1.0">
  
  <xsl:output method="text"/>
  
  <!-- function to return the number of bottles as a string -->
  <xsl:template name="item">
  <xsl:param name="n"/>
  
  <!-- n bottles -->
  <xsl:if test="$n > 1">
  <xsl:value-of select="$n"/>
  <xsl:text> </xsl:text>
  <xsl:value-of select="*/container-plural"/>
  </xsl:if>
  
  <!-- 1 bottle -->
  <xsl:if test="$n = 1">
  <xsl:value-of select="$n"/>
  <xsl:text> </xsl:text>
  <xsl:value-of select="*/container-singular"/>
  </xsl:if>
  
  <!-- No more -->
  <xsl:if test="$n = 0">
  <xsl:text>No more </xsl:text>
  <xsl:value-of select="*/container-plural"/>
  </xsl:if>
  
  <!-- of beer -->
  <xsl:text> of </xsl:text>
  <xsl:value-of select="*/item"/>
  </xsl:template>
  
  <!-- recursive function to sing the verses of the song -->
  <xsl:template name="sing">
  <xsl:param name="quantity"/>
  
  <!-- get the current number of bottles as a string -->
  <xsl:variable name="itemname">
  <xsl:call-template name="item">
  <xsl:with-param name="n" select="$quantity"/>
  </xsl:call-template>
  </xsl:variable>
  
  <!-- get the number of bottles after taking one down -->
  <xsl:variable name="itemnext">
  <xsl:call-template name="item">
  <xsl:with-param name="n" select="$quantity - 1"/>
  </xsl:call-template>
  </xsl:variable>
  
  <!-- "n bottles of beer on the wall," -->
  <xsl:value-of select="$itemname"/>
  <xsl:text> </xsl:text>
  <xsl:value-of select="*/location"/>
  <xsl:text>,&#xA;</xsl:text>
  
  <!-- "n bottles of beer," -->
  <xsl:value-of select="$itemname"/>
  <xsl:text>,&#xA;</xsl:text>
  
  <!-- "You take one down, pass it around," -->
  <xsl:value-of select="*/retrieve"/>
  <xsl:text>, </xsl:text>
  <xsl:value-of select="*/distribute"/>
  <xsl:text>,&#xA;</xsl:text>
  
  <!--" n-1 bottles of beer on the wall." -->
  <xsl:value-of select="$itemnext"/>
  <xsl:text> </xsl:text>
  <xsl:value-of select="*/location"/>
  <xsl:text>.&#xA;&#xA;</xsl:text>
  
  <!-- recurse to the next bottle of beer -->
  <xsl:if test="$quantity != 1">
  <xsl:call-template name="sing">
  <xsl:with-param name="quantity" select="$quantity - 1"/>
  </xsl:call-template>
  </xsl:if>
  </xsl:template>
  
  <!-- output the song based on the xml input parameters -->
  <xsl:template match="/">
  <xsl:text>&#xA;&#xA;</xsl:text>
  <xsl:call-template name="sing">
  <xsl:with-param name="quantity" select="*/quantity"/>
  </xsl:call-template>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  
xml-xalan/test/tests/contrib/xsltc/schemasoft/calendar.xml
  
  Index: calendar.xml
  ===================================================================
  <month start="3" days="31">
  <name>May 2001</name>
  </month>
  
  
  
  1.1                  
xml-xalan/test/tests/contrib/xsltc/schemasoft/calendar.xsl
  
  Index: calendar.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
  <!-- Author:  Muhammad Athar Parvez -->
  <!-- Reference: 
http://www.incrementaldevelopment.com/xsltrick/parvez/#calendar -->
  <!-- Description: Print out an html calander of a month -->
  
  <xsl:output method="xml" encoding="UTF-8"/>
  
  <xsl:variable name="start" select="/month/@start"/>
  <xsl:variable name="count" select="/month/@days"/>
  
  <xsl:variable name="total" select="$start + $count - 1"/>
  <xsl:variable name="overflow" select="$total mod 7"/>
  
  <xsl:variable name="nelements">
  <xsl:choose>
  <xsl:when test="$overflow > 0"><xsl:value-of select="$total + 7 - 
$overflow"/></xsl:when>
  <xsl:otherwise><xsl:value-of select="$total"/></xsl:otherwise>
  </xsl:choose>
  </xsl:variable>
  
  <xsl:template match="/">
  
  <html>
  <head><title><xsl:value-of select="month/name"/></title></head>
  
  <body bgcolor="lightyellow">
  
  <h1 align="center"><xsl:value-of select="month/name"/></h1>
  
  <table border="1" bgcolor="lightblue" noshade="yes" align="center">
  <tr bgcolor="white">
  
<th>Sun</th><th>Mon</th><th>Tue</th><th>Wed</th><th>Thu</th><th>Fri</th><th>Sat</th>
  </tr>
  
  <xsl:call-template name="month"/>
  </table>
  
  </body></html>
  
  </xsl:template>
  
  <!-- Called only once for root -->
  <!-- Uses recursion with index + 7 for each week -->
  <xsl:template name="month">
  <xsl:param name="index" select="1"/>
  
  <xsl:if test="$index &lt; $nelements">
  <xsl:call-template name="week">
  <xsl:with-param name="index" select="$index"/>
  </xsl:call-template>
  
  <xsl:call-template name="month">
  <xsl:with-param name="index" select="$index + 7"/>
  </xsl:call-template>
  </xsl:if>
  
  </xsl:template>
  
  <!-- Called repeatedly by month for each week -->
  <xsl:template name="week">
  <xsl:param name="index" select="1"/>
  <tr>
  <xsl:call-template name="days">
  <xsl:with-param name="index" select="$index"/>
  <xsl:with-param name="counter" select="$index + 6"/>
  </xsl:call-template>
  </tr>
  </xsl:template>
  
  <!-- Called by week -->
  <!-- Uses recursion with index + 1 for each day-of-week -->
  <xsl:template name="days">
  <xsl:param name="index" select="1"/>
  <xsl:param name="counter" select="1"/>
  
  <xsl:choose>
  <xsl:when test="$index &lt; $start">
  <td>-</td>
  </xsl:when>
  
  <xsl:when test="$index - $start + 1 > $count">
  <td>-</td>
  </xsl:when>
  
  <xsl:when test="$index > $start - 1">
  <td><xsl:value-of select="$index - $start + 1"/></td>
  </xsl:when>
  
  </xsl:choose>
  
  <xsl:if test="$counter > $index">
  <xsl:call-template name="days">
  <xsl:with-param name="index" select="$index + 1"/>
  <xsl:with-param name="counter" select="$counter"/>
  </xsl:call-template>
  </xsl:if>
  
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  
  1.1                  
xml-xalan/test/tests/contrib/xsltc/schemasoft/differentiate.xml
  
  Index: differentiate.xml
  ===================================================================
  <function-of-x>
  <term><coeff>1</coeff><x/><power>3</power></term>
  <term><coeff>2</coeff><x/><power>2</power></term>
  <term><coeff>3</coeff><x/><power>1</power></term>
  <term><coeff>4</coeff><x/><power>0</power></term>
  </function-of-x>
  
  
  
  1.1                  
xml-xalan/test/tests/contrib/xsltc/schemasoft/differentiate.xsl
  
  Index: differentiate.xsl
  ===================================================================
  <?xml version='1.0'?>
  <xsl:stylesheet
        version='1.0'
        xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
  
  <!-- Description:  Differentiates a simple polynomial function -->
  <!-- Author:  Charlie Halpern-Hamu, Ph.D. -->
  <!-- Reference:  
http://www.incrementaldevelopment.com/papers/xsltrick/#differentiate -->
  
  <xsl:strip-space elements='*'/>
  
  <xsl:output
          method='xml'
          indent='yes'/>
  
  <xsl:template match='/function-of-x'>
  <xsl:element name='function-of-x'>
  <xsl:apply-templates select='term'/>
  </xsl:element>
  </xsl:template>
  
  <xsl:template match='term'>
  <term>
  <coeff>
  <xsl:value-of select='coeff * power'/>
  </coeff>
  <x/>
  <power>
  <xsl:value-of select='power - 1'/>
  </power>
  </term>
  </xsl:template>
  </xsl:stylesheet>
  
  
  
  1.1                  
xml-xalan/test/tests/contrib/xsltc/schemasoft/eratosthenes.xml
  
  Index: eratosthenes.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <!-- 
     The Sieve of Eratosthenes input
     GPL (c) Oliver Becker, 2000-06-13
     [EMAIL PROTECTED]
  -->
  <dummy></dummy>
  
  
  
  1.1                  
xml-xalan/test/tests/contrib/xsltc/schemasoft/eratosthenes.xsl
  
  Index: eratosthenes.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <!-- 
     The Sieve of Eratosthenes
     GPL (c) Oliver Becker, 2000-06-13
     [EMAIL PROTECTED]
  -->
  
  <xslt:transform xmlns:xslt="http://www.w3.org/1999/XSL/Transform";
                  version="1.0">
  
  <xslt:output method="text" />
  
  <xslt:param name="bound" select="1000" />
  
  <xslt:template match="/">
     <xslt:call-template name="eratosthenes">
        <xslt:with-param name="pos" select="2" />
        <xslt:with-param name="array">
           <xslt:call-template name="init-array">
              <xslt:with-param name="length" select="$bound" />
           </xslt:call-template>
        </xslt:with-param>
     </xslt:call-template>
     <xslt:text>&#xA;</xslt:text>
  </xslt:template>
  
  
  <!-- Initialize the array (string) with length $length -->
  <xslt:template name="init-array">
     <xslt:param name="length" />
     <xslt:if test="$length &gt; 0">
        <xslt:text>-</xslt:text>
        <xslt:call-template name="init-array">
           <xslt:with-param name="length" select="$length - 1" />
        </xslt:call-template>
     </xslt:if>
  </xslt:template>
  
  
  <!-- Sieve of Eratosthenes: If the number at position $pos isn't 
       marked then it's a prime (and printed). If the position of the
       prime is lower or equal then the square root of $bound then the 
       new array will be computed by marking all multiples of $pos. -->
  <xslt:template name="eratosthenes">
     <xslt:param name="array" />
     <xslt:param name="pos" />
     <xslt:if test="$pos &lt; $bound">
        <xslt:variable name="is-prime" 
                       select="substring($array,$pos,1) = '-'" />
        <xslt:if test="$is-prime">
           <xslt:value-of select="$pos" />, <xslt:text />
        </xslt:if>
        <xslt:variable name="new-array">
           <xslt:choose>
              <xslt:when test="$is-prime and $pos*$pos &lt;= $bound">
                 <xslt:call-template name="mark">
                    <xslt:with-param name="array" select="$array" />
                    <xslt:with-param name="number" select="$pos" />
                 </xslt:call-template>
              </xslt:when>
              <xslt:otherwise>
                 <xslt:value-of select="$array" />
              </xslt:otherwise>
           </xslt:choose>
        </xslt:variable>
        <xslt:call-template name="eratosthenes">
           <xslt:with-param name="array" select="$new-array" />
           <xslt:with-param name="pos" select="$pos + 1" />
        </xslt:call-template>
     </xslt:if>
  </xslt:template>
  
  
  <!-- Mark all multiples of $number in $array with '*' -->
  <xslt:template name="mark">
     <xslt:param name="array" />
     <xslt:param name="number" />
     <xslt:choose>
        <xslt:when test="string-length($array) &gt; $number">
           <xslt:value-of select="substring ($array, 1, $number - 1)" />
           <xslt:text>*</xslt:text>
           <xslt:call-template name="mark">
              <xslt:with-param name="array" 
                               select="substring ($array, $number + 1)" />
              <xslt:with-param name="number" select="$number" />
           </xslt:call-template>
        </xslt:when>
        <xslt:otherwise>
           <xslt:value-of select="$array" />
        </xslt:otherwise>
     </xslt:choose>
  </xslt:template>
  
  </xslt:transform>
  
  
  
  1.1                  
xml-xalan/test/tests/contrib/xsltc/schemasoft/factorial.xml
  
  Index: factorial.xml
  ===================================================================
  <dummy>foo</dummy>
  
  
  
  1.1                  
xml-xalan/test/tests/contrib/xsltc/schemasoft/factorial.xsl
  
  Index: factorial.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
  <!-- Author:  Chris Rathman -->
  <!-- Reference:  http://www.angelfire.com/tx4/cus/notes/xslfactorial.html -->
  <!-- Description:  Computes factorial as a demonstration of recursion -->
  
  <xsl:output method="text"/>
  
  <!-- x := 5 -->
  <xsl:variable name="x" select="5"/>
  
  <!-- y := factorial(x) -->
  <xsl:variable name="y">
  <xsl:call-template name="factorial">
  <xsl:with-param name="n" select="$x"/>
  </xsl:call-template>
  </xsl:variable>
  
  <!-- factorial(n) - compute the factorial of a number -->
  <xsl:template name="factorial">
  <xsl:param name="n" select="1"/>
  <xsl:variable name="sum">
  <xsl:if test="$n = 1">1</xsl:if>
  <xsl:if test="$n != 1">
  <xsl:call-template name="factorial">
  <xsl:with-param name="n" select="$n - 1"/>
  </xsl:call-template>
  </xsl:if>
  </xsl:variable>
  <xsl:value-of select="$sum * $n"/>
  </xsl:template>
  
  <!-- output the results -->
  <xsl:template match="/">
  <xsl:text>factorial(</xsl:text>
  <xsl:value-of select="$x"/>
  <xsl:text>) = </xsl:text>
  <xsl:value-of select="$y"/>
  <xsl:text>&#xA;</xsl:text>
  
  <!-- calculate another factorial for grins -->
  <xsl:text>factorial(4) = </xsl:text>
  <xsl:call-template name="factorial">
  <xsl:with-param name="n" select="5"/>
  </xsl:call-template>
  <xsl:text>&#xA;</xsl:text>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  
  1.1                  xml-xalan/test/tests/contrib/xsltc/schemasoft/log10.xml
  
  Index: log10.xml
  ===================================================================
  
  <bugTotals>
  
        <byState>
                <open>
                        <total date="may 1" value="3"/>
                        <total date="may 2" value="13"/>
                        <total date="may 3" value="12"/>
                        <total date="may 4" value="22"/>
                        <total date="may 5" value="5"/>
                        <total date="may 6" value="8"/>
                        <total date="may 7" value="2"/>
                        <total date="may 8" value="4"/>
                        <total date="may 9" value="1"/>
                </open>
  
                <testing>
                        <total date="may 1" value="0"/>
                        <total date="may 2" value="3"/>
                        <total date="may 3" value="10"/>
                        <total date="may 4" value="2"/>
                        <total date="may 5" value="15"/>
                        <total date="may 6" value="4"/>
                        <total date="may 7" value="8"/>
                        <total date="may 8" value="2"/>
                        <total date="may 9" value="0"/>
                </testing>
  
                <closed>
                        <total date="may 1" value="0"/>
                        <total date="may 2" value="3"/>
                        <total date="may 3" value="4"/>
                        <total date="may 4" value="7"/>
                        <total date="may 5" value="15"/>
                        <total date="may 6" value="22"/>
                        <total date="may 7" value="22"/>
                        <total date="may 8" value="24"/>
                        <total date="may 9" value="28"/>
                </closed>
  
        </byState>
  
  </bugTotals>
  
  
  
  
  1.1                  xml-xalan/test/tests/contrib/xsltc/schemasoft/log10.xsl
  
  Index: log10.xsl
  ===================================================================
  <xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
        <xsl:output method="text" />
  
    <!-- FileName: log10.xsl -->
    <!-- Author: Darryl Fuller, SchemaSoft -->
    <!-- Purpose: Torture test, compute log10 recursivly for the a bunch of 
numbers -->
  
  
        <xsl:template match="/">
                <xsl:for-each select="./*/*/*/*">
                        <xsl:variable name="val" select="position()"/>
                        <xsl:variable name="logval">
                                <xsl:call-template name="log10">
                                        <xsl:with-param name="x" select="$val"/>
                                </xsl:call-template>
                        </xsl:variable>
  Value: <xsl:value-of select="$val"/> Log10: <xsl:value-of select="$logval"/>
                </xsl:for-each>
        </xsl:template>
  
        <xsl:template name="ln" >
                <xsl:param name="x"/>
                <xsl:variable name="e">2.71828182845904</xsl:variable>
                <xsl:choose>
                        <xsl:when test="$x = 0">0</xsl:when>
                        <!-- technically, a negative number should be NaN, but 
we will
                     instead pretend we're just scaling a negative number
                     with the ln function -->
                        <xsl:when test="$x &lt; 0">
                                <xsl:variable name="scaled_answer">
                                        <xsl:call-template name="ln">
                                                <xsl:with-param name="x" 
select="$x * -1"/>
                                        </xsl:call-template>
                                </xsl:variable>
                                <xsl:value-of select="$scaled_answer * -1"/>
                        </xsl:when>
                        <!-- A table of some common values -->
                        <xsl:when test="$x = 10">2.3025850929940</xsl:when>
                        <xsl:when test="$x = 20">2.9957322735539</xsl:when>
                        <xsl:when test="$x = 30">3.4011973816621</xsl:when>
                        <xsl:when test="$x = 40">3.6888794541139</xsl:when>
                        <xsl:when test="$x = 50">3.9120230054281</xsl:when>
                        <xsl:when test="$x = 60">4.0943445622221</xsl:when>
                        <xsl:when test="$x = 70">4.2484952420493</xsl:when>
                        <xsl:when test="$x = 80">4.3820266346738</xsl:when>
                        <xsl:when test="$x = 90">4.4998096703302</xsl:when>
                        <xsl:when test="$x = 100">4.6051701859881</xsl:when>
                        <xsl:when test="$x = 200">5.2983173665480</xsl:when>
                        <xsl:when test="$x = 300">5.7037824746562</xsl:when>
                        <xsl:when test="$x = 400">5.9914645471079</xsl:when>
                        <xsl:when test="$x = 500">6.2146080984222</xsl:when>
                        <xsl:when test="$x = 600">6.3969296552161</xsl:when>
                        <xsl:when test="$x = 700">6.5510803350434</xsl:when>
                        <xsl:when test="$x = 800">6.6846117276679</xsl:when>
                        <xsl:when test="$x = 900">6.8023947633243</xsl:when>
                        <xsl:when test="$x = 1000">6.90775527898213</xsl:when>
                        <!-- scale the answer -->
                        <xsl:when test="$x &gt; 20">
                                <xsl:variable name="scaled_answer">
                                        <xsl:call-template name="ln">
                                                <xsl:with-param name="x" 
select="$x div $e"/>
                                        </xsl:call-template>
                                </xsl:variable>
                                <xsl:value-of select="$scaled_answer + 1"/>
                        </xsl:when>
                        <!-- scale the answer -->
                        <xsl:when test="$x &lt; 0.005">
                                <xsl:variable name="scaled_answer">
                                        <xsl:call-template name="ln">
                                                <xsl:with-param name="x" 
select="$x * $e"/>
                                        </xsl:call-template>
                                </xsl:variable>
                                <xsl:value-of select="$scaled_answer - 1"/>
                        </xsl:when>
                        <!-- The straight goods -->
                        <xsl:otherwise>
                                <xsl:variable name="z">
                                        <xsl:call-template name="z_value">
                                                <xsl:with-param name="x" 
select="$x"/>
                                        </xsl:call-template>
                                </xsl:variable>
                                <xsl:variable name="interim_answer">
                                        <xsl:call-template name="ln_recurse">
                                                <xsl:with-param name="z" 
select="$z"/>
                                                <xsl:with-param name="current" 
select="0"/>
                                                <xsl:with-param name="term" 
select="1"/>
                                        </xsl:call-template>
                                </xsl:variable>
                                <xsl:value-of select="$interim_answer * 2"/>
                        </xsl:otherwise>
                </xsl:choose>
        </xsl:template>
        <xsl:template name="z_value">
                <xsl:param name="x"/>
                <xsl:value-of select="($x - 1) div ($x + 1)"/>
        </xsl:template>
        <xsl:template name="ln_recurse">
                <xsl:param name="z"/>
                <xsl:param name="current"/>
                <xsl:param name="term"/>
                <xsl:variable name="term_value">
                        <xsl:call-template name="ln_term">
                                <xsl:with-param name="z" select="$z"/>
                                <xsl:with-param name="n" select="$term"/>
                        </xsl:call-template>
                </xsl:variable>
                <xsl:variable name="val" select="$current + $term_value"/>
                <xsl:choose>
                        <xsl:when test="$val = $current">
                                <xsl:value-of select="$current"/>
                        </xsl:when>
                        <!-- Limiting the number of terms we calculate to is a 
trade
                     off of accuracy v.s. speed.  I'm currently sacrificing
                     accuracy for a bit o' speed to make this less painfully
                     slow -->
                        <xsl:when test="$term &gt; 100">
                                <xsl:value-of select="$current"/>
                        </xsl:when>
                        <xsl:otherwise>
                                <xsl:call-template name="ln_recurse">
                                        <xsl:with-param name="z" select="$z"/>
                                        <xsl:with-param name="current" 
select="$val"/>
                                        <xsl:with-param name="term" 
select="$term + 2"/>
                                </xsl:call-template>
                        </xsl:otherwise>
                </xsl:choose>
        </xsl:template>
        <xsl:template name="ln_term">
                <xsl:param name="z"/>
                <xsl:param name="n"/>
                <xsl:variable name="numerator">
                        <xsl:call-template name="pow_function">
                                <xsl:with-param name="number" select="$z"/>
                                <xsl:with-param name="power" select="$n"/>
                        </xsl:call-template>
                </xsl:variable>
                <xsl:value-of select="$numerator div $n"/>
        </xsl:template>
        <xsl:template name="pow_function" ><!-- Power function.  
        Calculates number ^ power where power is an 
        integer. -->
                <xsl:param name="number"/>
                <xsl:param name="power"/>
  
                <xsl:variable name="int_power" select="round( $power )"/>
                <xsl:variable name="rest">
                        <xsl:choose>
                                <xsl:when test="$int_power &gt; 0">
                                        <xsl:call-template name="pow_function">
                                                <xsl:with-param name="number" 
select="$number"/>
                                                <xsl:with-param name="power" 
select="$int_power - 1"/>
                                        </xsl:call-template>
                                </xsl:when>
                                <xsl:when test="$int_power &lt; 0">
                                        <xsl:call-template name="pow_function">
                                                <xsl:with-param name="number" 
select="$number"/>
                                                <xsl:with-param name="power" 
select="$int_power + 1"/>
                                        </xsl:call-template>
                                </xsl:when>
                                <xsl:otherwise>1</xsl:otherwise>
                        </xsl:choose>
                </xsl:variable>
                <xsl:variable name="result">
                        <xsl:choose>
                                <xsl:when test="$int_power &gt; 0">
                                        <xsl:value-of select="$rest * $number"/>
                                </xsl:when>
                                <xsl:when test="$int_power &lt; 0">
                                        <xsl:value-of select="$rest div 
$number"/>
                                </xsl:when>
                                <xsl:otherwise>
                                1
                        </xsl:otherwise>
                        </xsl:choose>
                </xsl:variable>
                <xsl:value-of select="$result"/>
        </xsl:template>
        <xsl:template name="log10"><!-- Log (base 10). -->
                <xsl:param name="x"/>
                        <xsl:variable name="numerator">
                                <xsl:call-template name="ln">
                                        <xsl:with-param name="x" select="$x"/>
                                </xsl:call-template>
                        </xsl:variable>
                        <!-- ln(10) -->
                        <xsl:variable name="denominator" 
select="2.302585092994045684"/>
                        <xsl:value-of select="$numerator div $denominator"/>
        </xsl:template>
  
  
        </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/contrib/xsltc/schemasoft/pi.xml
  
  Index: pi.xml
  ===================================================================
  <dummy>foo</dummy>
  
  
  
  1.1                  xml-xalan/test/tests/contrib/xsltc/schemasoft/pi.xsl
  
  Index: pi.xsl
  ===================================================================
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
       version="1.0">
  <xsl:output method="text"/>
  
  <!-- Author: Bob DuCharme -->
  <!-- Reference:  http://www.xml.com/pub/a/2001/05/07/xsltmath.html -->
  <!-- Description: Compute pi. Based on Leibniz's algorithm that 
         pi/4 = 1 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11... which I did as
         pi = 4 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11...
  -->
  
  <xsl:variable name="iterations" select="4500"/>
  
  <xsl:template name="pi">
    <!-- named template called by main template below -->
    <xsl:param name="i">1</xsl:param>
    <xsl:param name="piValue">0</xsl:param>
  
    <xsl:choose>
    <!-- If there are more iterations to do, add the passed
         value of pi to another round of calculations. -->
    <xsl:when test="$i &lt;= $iterations">
      <xsl:call-template name="pi">
        <xsl:with-param name="i" select="$i + 4"/>
        <xsl:with-param name="piValue" 
             select="$piValue + (4 div $i) - (4 div ($i + 2))"/>
      </xsl:call-template>
    </xsl:when>
  
    <!-- If no more iterations to do, add 
         computed value to result tree. -->
    <xsl:otherwise>
     <xsl:value-of select="$piValue"/>
    </xsl:otherwise>
  
    </xsl:choose>
  
  </xsl:template>
  
  
  <xsl:template match="/">
    <xsl:call-template name="pi"/>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  
  1.1                  
xml-xalan/test/tests/contrib/xsltc/schemasoft/queryOnSubElement.xml
  
  Index: queryOnSubElement.xml
  ===================================================================
  <a>
   <b>b content,
    <d>d in b,</d>
   </b>
   <c>
    <d>d in c,</d>
  
  <g>g content,</g>
  
  
   </c>
   <e> </e>
   <f>f content,
     <g>g in f,
     <d>d in f/g,
      </d> </g> </f>
  </a>
  
  
  
  
  1.1                  
xml-xalan/test/tests/contrib/xsltc/schemasoft/queryOnSubElement.xsl
  
  Index: queryOnSubElement.xsl
  ===================================================================
  <?xml version="1.0"?>
  <!-- queryOnSubElement.xslt
  Selects  a given tag according to the content of a subelement. This transform 
is completely parametrized.
  Copyright J.M. Vanel 2000 - under GNU public licence 
  -->
  
  <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
                   version="1.0" >
  
  <xsl:param name="wantedTag">b</xsl:param>
  <xsl:param name="wantedsubElement">d</xsl:param>
  <xsl:param name="wantedString">d in b</xsl:param>
  
    <xsl:template match="/">
      <Collection>
        <xsl:copy-of select="//* [ name(.) = $wantedTag]
                             [ * [ name(.) = $wantedsubElement] 
                             [contains(., $wantedString) ] ]" />
      </Collection>
    </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  
xml-xalan/test/tests/contrib/xsltc/schemasoft/selectHREF.xml
  
  Index: selectHREF.xml
  ===================================================================
  <a>
   <b href="hrefIn_b-1rstLevel">b content,
    <d>d in b,</d>
   </b>
   <c>
    <d>d in c,</d>
    <g href="hrefIn_g-2ndLevel">g content,</g>
   </c>
   <e> </e>
   <f>f content,
     <g>g in f,
     <d>d in f/g,
      </d> </g> </f>
  </a>
  
  
  
  
  1.1                  
xml-xalan/test/tests/contrib/xsltc/schemasoft/selectHREF.xsl
  
  Index: selectHREF.xsl
  ===================================================================
  <?xml version="1.0"?>
  <!-- Extracts href attributes
  
  Copyright J.M. Vanel 2000 - under GNU public licence 
  xt testHREF.xml selectHREF.xslt > selectHREF.txt
   -->
  
  <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
                  version="1.0" >
  
  <xsl:output method="text"/>
  
  <xsl:template match ="*" >
    <xsl:apply-templates select="*|@*" />
   </xsl:template>
  
   <xsl:template match ="@href|@HREF" >
     href=<xsl:value-of select='.' />
   </xsl:template>
  
   <!-- Suppress element text content : -->
   <xsl:template match ="text()" ></xsl:template>
  
   <xsl:template match ="/" >
    <xsl:apply-templates/>
   </xsl:template>
  </xsl:stylesheet>
  
  
  
  1.1                  
xml-xalan/test/tests/contrib/xsltc/schemasoft/suppressEmptyElements.xml
  
  Index: suppressEmptyElements.xml
  ===================================================================
  <Collection><a><b><d/></b><c><d/></c>
  <f><g><d>d in f/g </d></g></f></a></Collection>
  
  
  
  1.1                  
xml-xalan/test/tests/contrib/xsltc/schemasoft/suppressEmptyElements.xsl
  
  Index: suppressEmptyElements.xsl
  ===================================================================
  <?xml version="1.0"?>
  <!-- Suppress branches without text content
    -->
  
  <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
  >
  
   <xsl:template match="* [.//text()] | text() ">
    <xsl:copy>
      <xsl:apply-templates />
    </xsl:copy>
   </xsl:template>
  
   <xsl:template match="/">
    <xsl:apply-templates /> 
   </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to