dmarston    01/06/28 14:02:48

  Modified:    test/tests/conf/position position80.xsl position80.xml
  Added:       test/tests/conf/position position84.xsl position81.xml
                        position81.xsl position82.xml position82.xsl
                        position83.xml position83.xsl position84.xml
  Log:
  More tests of count() and last() in tricky situations.
  
  Revision  Changes    Path
  1.2       +18 -15    xml-xalan/test/tests/conf/position/position80.xsl
  
  Index: position80.xsl
  ===================================================================
  RCS file: /home/cvs/xml-xalan/test/tests/conf/position/position80.xsl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- position80.xsl    2001/06/23 05:29:43     1.1
  +++ position80.xsl    2001/06/28 21:02:47     1.2
  @@ -1,30 +1,33 @@
   <?xml version="1.0"?>
   <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  -                version="1.0">
  +    version="1.0">
   
     <!-- FileName: position80 -->
     <!-- Document: http://www.w3.org/TR/xpath -->
     <!-- DocVersion: 19991116 -->
     <!-- Section: 2.2 -->
     <!-- Purpose: Ensure last() is working with unionpaths of ancestors. -->
  -  <!-- Author: Scott Boag -->
  +  <!-- Creator: Scott Boag -->
   
   <xsl:template match="/">
     <out>
  -     <xsl:for-each select="//section/title">
  -
  -       <xsl:for-each select="(ancestor::section
  -                                                     |ancestor::simplesect
  -                                                     |ancestor::sect1
  -                                                     |ancestor::sect2
  -                                                     |ancestor::sect3
  -                                                     |ancestor::sect4
  -                                                     
|ancestor::sect5)[last()]">
  -             <name><xsl:value-of select="name(.)"/></name>
  -       </xsl:for-each>
  -     </xsl:for-each>
  +    <xsl:for-each select="//section/title">
  +      Title= <xsl:value-of select="."/>
  +      <xsl:variable name="size">
  +        <xsl:value-of select="count(ancestor::section
  +          |ancestor::simplesect|ancestor::articleinfo)"/>
  +      </xsl:variable>
  +      <xsl:for-each select="(ancestor::section|ancestor::simplesect
  +        |ancestor::articleinfo)[last()]">
  +        <name>
  +          <xsl:attribute name="last-of">
  +            <xsl:value-of select="$size"/>
  +          </xsl:attribute>
  +          <xsl:value-of select="name(.)"/>
  +        </name>
  +      </xsl:for-each>
  +    </xsl:for-each>
     </out>
   </xsl:template>
  -
   
   </xsl:stylesheet>
  
  
  
  1.2       +19 -21    xml-xalan/test/tests/conf/position/position80.xml
  
  Index: position80.xml
  ===================================================================
  RCS file: /home/cvs/xml-xalan/test/tests/conf/position/position80.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- position80.xml    2001/06/23 05:29:43     1.1
  +++ position80.xml    2001/06/28 21:02:47     1.2
  @@ -1,23 +1,21 @@
   <article class="whitepaper" status="Note">
  -<articleinfo>
  -<title>XXX</title>
  -</articleinfo>
  -
  -<section id="intro"><title>Introduction</title>
  -
  -<para>...</para>
  -
  -</section>
  -
  -<section><title>YYY</title>
  -
  -<para>...</para>
  -
  -<section revisionflag="added"><title>ZZZ</title>
  -
  -<para>This is the section titled "ZZZ".</para>
  -
  -</section>
  -</section>
  -
  +  <articleinfo>
  +    <title>AAA</title>
  +    <section id="info">
  +      <title>BBB</title>
  +      <para>About this article</para>
  +    </section>
  +  </articleinfo>
  +  <section id="intro">
  +    <title>CCC</title>
  +    <para>...</para>
  +  </section>
  +  <section>
  +    <title>YYY</title>
  +    <para>...</para>
  +    <section revisionflag="added">
  +      <title>ZZZ</title>
  +      <para>This is the section titled "ZZZ".</para>
  +    </section>
  +  </section>
   </article>
  
  
  
  1.1                  xml-xalan/test/tests/conf/position/position84.xsl
  
  Index: position84.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
      version="1.0">
  
    <!-- FileName: position83 -->
    <!-- Document: http://www.w3.org/TR/xpath -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 2.2 -->
    <!-- Purpose: Try positional filter on unionpaths that aren't sequential. 
-->
    <!-- Creator: David Marston -->
  
  <xsl:template match="/">
    <out>
      <xsl:for-each select="//title">
        Title= <xsl:value-of select="."/>
        <name>
          <xsl:attribute name="first-of">
            <xsl:value-of select="count(ancestor::section
              |../ednote|following::title|../bogus)"/>
          </xsl:attribute>
          <xsl:value-of select="name((ancestor::section|../ednote
            |following::title|../bogus)[1])"/>
        </name>
      </xsl:for-each>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/position/position81.xml
  
  Index: position81.xml
  ===================================================================
  <doc>
    <alpha key="a">
      <z>5</z>
    </alpha>
    <alpha key="b">
      <b>3</b>
      <z>9</z>
    </alpha>
    <alpha key="c">
      <z>2</z>
      <z>5</z>
    </alpha>
    <alpha key="d">
      <z>4</z>
      <z>12</z>
      <z>5</z>
    </alpha>
    <alpha key="e">
      <z>6</z>
      <z>11</z>
      <e>1</e>
    </alpha>
    <alpha key="f">
      <f>8</f>
      <z>4</z>
      <z>3</z>
      <z>8</z>
    </alpha>
    <alpha key="g">
      <z>7</z>
      <g>1</g>
      <z>10</z>
    </alpha>
    <alpha key="h">
      <h>1</h>
      <z>9</z>
      <h>4</h>
    </alpha>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/position/position81.xsl
  
  Index: position81.xsl
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: position81 -->
    <!-- Document: http://www.w3.org/TR/xpath -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 4.1 -->
    <!-- Creator: David Marston -->
    <!-- Purpose: Test of count() on a set filtered by the last() function. -->
  
  <xsl:template match="doc">
    <out>
      <xsl:value-of select="count(/doc/alpha[last()]/h)"/>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/position/position82.xml
  
  Index: position82.xml
  ===================================================================
  <doc>
    <alpha key="a">
      <z>5</z>
    </alpha>
    <alpha key="b">
      <b>3</b>
      <z>9</z>
    </alpha>
    <alpha key="c">
      <z>2</z>
      <z>5</z>
    </alpha>
    <alpha key="d">
      <z>4</z>
      <z>12</z>
      <z>5</z>
    </alpha>
    <alpha key="e">
      <z>6</z>
      <z>11</z>
      <e>1</e>
    </alpha>
    <alpha key="f">
      <f>8</f>
      <z>4</z>
      <z>3</z>
      <z>8</z>
    </alpha>
    <alpha key="g">
      <z>7</z>
      <g>1</g>
      <z>10</z>
    </alpha>
    <alpha key="h">
      <h>1</h>
      <z>9</z>
      <h>4</h>
    </alpha>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/position/position82.xsl
  
  Index: position82.xsl
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: position82 -->
    <!-- Document: http://www.w3.org/TR/xpath -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 4.1 -->
    <!-- Creator: David Marston -->
    <!-- Purpose: Test of count() on a set filtered by the last() function. -->
  
  <xsl:template match="doc">
    <out>
      <xsl:value-of select="count(alpha/*[last()][name()='z'])"/>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/position/position83.xml
  
  Index: position83.xml
  ===================================================================
  <article class="whitepaper" status="Note">
    <articleinfo>
      <title>AAA</title>
      <section id="info">
        <title>BBB</title>
        <para>About this article</para>
        <section revisionflag="added">
          <title>CCC</title>
          <para>This is the section titled "ZZZ".</para>
          <ednote who="KKK">
            <title>DDD</title>
            <para>Don't worry.</para>
            <section revisionflag="added">
              <title>EEE</title>
              <para>This is the deep subsection.</para>
            </section>
          </ednote>
        </section>
      </section>
    </articleinfo>
  </article>
  
  
  
  1.1                  xml-xalan/test/tests/conf/position/position83.xsl
  
  Index: position83.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
      version="1.0">
  
    <!-- FileName: position83 -->
    <!-- Document: http://www.w3.org/TR/xpath -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 2.2 -->
    <!-- Purpose: Try count() and last() on unionpaths that aren't sequential. 
-->
    <!-- Creator: David Marston -->
  
  <xsl:template match="/">
    <out>
      <xsl:for-each select="//section/title">
        Title= <xsl:value-of select="."/>
        <name>
          <xsl:attribute name="last-of">
            <xsl:value-of select="count(ancestor::section
              |ancestor::simplesect|ancestor::article)"/>
          </xsl:attribute>
          <xsl:value-of select="name((ancestor::section|ancestor::simplesect
            |ancestor::article)[last()])"/>
        </name>
      </xsl:for-each>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/position/position84.xml
  
  Index: position84.xml
  ===================================================================
  <article class="whitepaper" status="Note">
    <articleinfo>
      <title>AAA</title>
      <section id="info">
        <title>BBB</title>
        <para>About this article</para>
        <section revisionflag="added">
          <title>CCC</title>
          <para>This is the section titled "ZZZ".</para>
          <ednote who="KKK">
            <title>DDD</title>
            <para>Don't worry.</para>
            <section revisionflag="added">
              <title>EEE</title>
              <para>This is the deep subsection.</para>
            </section>
          </ednote>
        </section>
      </section>
    </articleinfo>
  </article>
  
  
  

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

Reply via email to