dmarston    00/12/15 12:00:34

  Added:       test/tests/conf/conditional conditional20.xsl
                        conditional01.xsl conditional02.xml
                        conditional02.xsl conditional03.xml
                        conditional03.xsl conditional04.xml
                        conditional04.xsl conditional05.xml
                        conditional05.xsl conditional06.xml
                        conditional06.xsl conditional07.xml
                        conditional07.xsl conditional08.xml
                        conditional08.xsl conditional09.xml
                        conditional09.xsl conditional10.xml
                        conditional10.xsl conditional11.xml
                        conditional11.xsl conditional12.xml
                        conditional12.xsl conditional13.xml
                        conditional13.xsl conditional14.xml
                        conditional14.xsl conditional15.xml
                        conditional15.xsl conditional16.xml
                        conditional16.xsl conditional17.xml
                        conditional17.xsl conditional18.xml
                        conditional18.xsl conditional19.xml
                        conditional19.xsl conditional20.xml
                        conditional01.xml
  Log:
  Copy of tests in Lotus/IBM repository
  
  Revision  Changes    Path
  1.1                  xml-xalan/test/tests/conf/conditional/conditional20.xsl
  
  Index: conditional20.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: conditional20 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 9.2 -->
    <!-- Purpose: Test two xsl:when elements using a variable in the test. -->
  
  <xsl:template match="doc">
    <out>
      <xsl:variable name="level" select="position()"/>
      <xsl:choose>        
        <xsl:when test="$level=1">
          <xsl:text>Found the first one.</xsl:text>
        </xsl:when>
        <xsl:when test="$level=2">
          <xsl:text>Found the second one.</xsl:text>
        </xsl:when>
      </xsl:choose>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional01.xsl
  
  Index: conditional01.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: conditional01 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 9.2 -->
    <!-- Purpose: General test of choose, with otherwise -->
  
  <xsl:template match="/doc">
    <out>
      <xsl:for-each select="person">
        <xsl:choose>
          <xsl:when test="sex='M'">&#xa;Male: </xsl:when>
          <xsl:when test="sex='F'">&#xa;Female: </xsl:when>
          <xsl:otherwise>&#xa;Who knows?: </xsl:otherwise>
        </xsl:choose>
        <xsl:value-of select="name"/>
      </xsl:for-each>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional02.xml
  
  Index: conditional02.xml
  ===================================================================
  <?xml version="1.0"?>
  <doc>
    <critter type="dog"><name>Lassie</name></critter>
    <critter type="dog"><name>Wishbone</name></critter>
    <critter type="cat"><name>Felix</name></critter>
    <critter type="cat"><name>Silvester</name></critter>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional02.xsl
  
  Index: conditional02.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: conditional02 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 9.2 -->
    <!-- Purpose: Test choose with no matches and missing otherwise clause. -->
    <!-- No expected output. -->
  
  <xsl:template match="/doc">
    <out>
      <xsl:for-each select="critter">
        <xsl:choose>
          <xsl:when test="@type='horse'">&#xa;Horse: </xsl:when>
          <xsl:when test="@type='cow'">&#xa;Cow: </xsl:when>
        </xsl:choose>
      </xsl:for-each>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional03.xml
  
  Index: conditional03.xml
  ===================================================================
  <?xml version="1.0"?>
  <doc>
    <critter><name>Lassie</name></critter>
    <critter><name>Wishbone</name></critter>
    <critter><name>Felix</name></critter>
    <critter><name>Silvester</name></critter>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional03.xsl
  
  Index: conditional03.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: conditional03 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 9.2 -->
    <!-- Creator: David Marston -->
    <!-- Purpose: Test for "when" testing on nonexsisent attribute node. -->
    <!-- No errors or output expected. -->
  
  <xsl:template match="/doc">
    <out>
      <xsl:for-each select="critter">
        <xsl:choose>
          <xsl:when test="@type='horse'">&#xa;Horse: </xsl:when>
          <xsl:when test="@type='cow'">&#xa;Cow: </xsl:when>
        </xsl:choose>
      </xsl:for-each>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional04.xml
  
  Index: conditional04.xml
  ===================================================================
  <?xml version="1.0"?>
  <doc>
    <foo/>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional04.xsl
  
  Index: conditional04.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: conditional04 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 9.2 -->
    <!-- Creator: David Marston -->
    <!-- Purpose: Test xsl:when by itself, success. -->
  
  <xsl:template match="doc">
    <out>
      <xsl:choose>
        <xsl:when test="foo">1</xsl:when>
      </xsl:choose>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional05.xml
  
  Index: conditional05.xml
  ===================================================================
  <?xml version="1.0"?>
  <doc>
    <foo/>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional05.xsl
  
  Index: conditional05.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: conditional05 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 9.2 -->
    <!-- Creator: David Marston -->
    <!-- Purpose: Test two xsl:when elements without xsl:otherwise, one 
succeeding. -->
  
  <xsl:template match="doc">
    <out>
      <xsl:choose>
        <xsl:when test="blah">2</xsl:when>
        <xsl:when test="foo">1</xsl:when>
      </xsl:choose>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional06.xml
  
  Index: conditional06.xml
  ===================================================================
  <?xml version="1.0"?>
  <doc>
    <blah>found</blah>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional06.xsl
  
  Index: conditional06.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: conditional06 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 9.2 -->
    <!-- Purpose: Test two xsl:when, no xsl:otherwise, second matches. -->
    <!-- Creator: David Marston -->
  
  <xsl:template match="doc">
    <out>
      <xsl:choose>
        <xsl:when test="yada">1</xsl:when>
        <xsl:when test="blah">2</xsl:when>
      </xsl:choose>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional07.xml
  
  Index: conditional07.xml
  ===================================================================
  <?xml version="1.0"?>
  <doc>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional07.xsl
  
  Index: conditional07.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: conditional07 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 9.2 -->
    <!-- Creator: David Marston -->
    <!-- Purpose: Test single when by itself, fail. -->
  
  <xsl:template match="doc">
    <out>
      <xsl:choose>
        <xsl:when test="blah">2</xsl:when>
      </xsl:choose>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional08.xml
  
  Index: conditional08.xml
  ===================================================================
  <?xml version="1.0"?>
  <doc>
    <foo/>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional08.xsl
  
  Index: conditional08.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: conditional08 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 9.2 -->
    <!-- Creator: David Marston -->
    <!-- Purpose: Test failing when with xsl:otherwise. -->
  
  <xsl:template match="doc">
    <out>
      <xsl:choose>
        <xsl:when test="blah">1</xsl:when>
        <xsl:otherwise>2</xsl:otherwise>
      </xsl:choose>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional09.xml
  
  Index: conditional09.xml
  ===================================================================
  <?xml version="1.0"?>
  <doc>
    <foo/>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional09.xsl
  
  Index: conditional09.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: conditional09 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 9.2 -->
    <!-- Creator: David Marston -->
    <!-- Purpose: Test single when with xsl:otherwise, success on when. -->
  
  <xsl:template match="doc">
    <out>
      <xsl:choose>
        <xsl:when test="foo">1</xsl:when>
        <xsl:otherwise>2</xsl:otherwise>
      </xsl:choose>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional10.xml
  
  Index: conditional10.xml
  ===================================================================
  <?xml version="1.0"?> 
  <doc>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional10.xsl
  
  Index: conditional10.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: conditional10 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 9.1 -->
    <!-- Purpose: Test xsl:if with simplistic boolean expression. -->
  
  <xsl:template match="/">
    <out>
    <xsl:if test="2=2">
      <xsl:text>number </xsl:text>
    </xsl:if>
    <xsl:if test="'a'='a'">
      <xsl:text>string</xsl:text>
    </xsl:if>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional11.xml
  
  Index: conditional11.xml
  ===================================================================
  <?xml version="1.0"?> 
  <doc>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional11.xsl
  
  Index: conditional11.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: conditional11 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 9.1 -->
    <!-- Creator: David Marston -->
    <!-- Purpose: Test xsl:if with test expression that converts to boolean 
true. -->
  
  <xsl:template match="/">
    <out>
    <xsl:if test="'StringConstant'">
      <xsl:text>StringConstant</xsl:text>
    </xsl:if>
    <xsl:if test="0">
      <xsl:text>Failed</xsl:text>
    </xsl:if>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional12.xml
  
  Index: conditional12.xml
  ===================================================================
  <?xml version="1.0"?> 
  <letters>
    <letter>a</letter>
    <letter>b</letter>
    <letter>c</letter>
    <letter>b</letter>
    <letter>h</letter>
  </letters>
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional12.xsl
  
  Index: conditional12.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: conditional12 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 9.1 -->
    <!-- Creator: David Marston -->
    <!-- Purpose: Test xsl:if with test involving current node value. -->
  
  <xsl:template match="letters">
    <out>
      <xsl:apply-templates select="letter"/>
    </out>
  </xsl:template>
  
  <xsl:template match="letter">
    <xsl:if test=".='b'">
      <xsl:text>Found b  </xsl:text>
    </xsl:if>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional13.xml
  
  Index: conditional13.xml
  ===================================================================
  <?xml version="1.0"?> 
  <letters>
    <letter>a</letter>
    <letter>b</letter>
    <letter>c</letter>
    <letter>b</letter>
    <letter>h</letter>
  </letters>
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional13.xsl
  
  Index: conditional13.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: conditional13 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 9.1 -->
    <!-- Creator: David Marston -->
    <!-- Purpose: Test xsl:if with boolean function and test of current node. 
-->
  
  <xsl:template match="letters">
    <out>
      <xsl:apply-templates select="letter"/>
    </out>
  </xsl:template>
  
  <xsl:template match="letter">
    <xsl:if test="not(.='b')">
      <xsl:text>not_b </xsl:text>
    </xsl:if>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional14.xml
  
  Index: conditional14.xml
  ===================================================================
  <?xml version="1.0"?>
  <Family>
  <Child>
  <Name>Harry</Name>
  <Personal_Information>
  <Sex>Male</Sex>
  <Age>45</Age>
  </Personal_Information>
  </Child>
  <Child>
  <Name>Tom</Name>
  <Personal_Information>
  <Sex>Male</Sex>
  <Age>30</Age>
  </Personal_Information>
  </Child>
  <Child>
  <Name>Dick</Name>
  <Personal_Information>
  <Sex>Male</Sex>
  <Age>40</Age>
  </Personal_Information>
  </Child>
  <Child>
  <Name>Paulette</Name>
  <Personal_Information>
  <Sex>Female</Sex>
  <Age>38</Age>
  </Personal_Information>
  </Child>
  <Child>
  <Name>Peter</Name>
  <Personal_Information>
  <Sex>Male</Sex>
  <Age>34</Age>
  </Personal_Information>
  </Child>
  </Family>
  
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional14.xsl
  
  Index: conditional14.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: conditional14 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 9.1 -->
    <!-- Purpose: Test xsl:if with test of subelement value. -->
  
  <xsl:template match="Family">
    <out>
      <xsl:apply-templates select="Child"/>
    </out>
  </xsl:template>
  
  <xsl:template match="Child">
    <xsl:if test='Personal_Information/Sex[.="Male"]' >
      <xsl:value-of select="./Name" />, he is <xsl:value-of 
select="Personal_Information/Age"/><xsl:text> years old.&#10;</xsl:text>
    </xsl:if>
    <xsl:if test='Personal_Information/Sex[.="Female"]' >
      <xsl:value-of select="./Name" />, she is <xsl:value-of 
select="Personal_Information/Age"/><xsl:text> years old.&#10;</xsl:text>
    </xsl:if>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional15.xml
  
  Index: conditional15.xml
  ===================================================================
  <?xml version="1.0"?> 
  <doc>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional15.xsl
  
  Index: conditional15.xsl
  ===================================================================
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: conditional15 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 9.1 -->
    <!-- Purpose: Test xsl:if with equality of result tree fragments. -->
  
  <xsl:variable name="v1">test</xsl:variable>
  <xsl:variable name="v2">test</xsl:variable>
  
  <xsl:template match="/">
    <out>
      <xsl:if test="$v1=$v2">Success1</xsl:if>
      <xsl:if test="string($v1)=string($v2)">Success2</xsl:if>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional16.xml
  
  Index: conditional16.xml
  ===================================================================
  <?xml version="1.0"?>
  <Family>
  <Child name="Harry">
  <Name>Harry</Name>
  </Child>
  <Child name="Tom">
  <Name>Tom</Name>
  </Child>
  <Child name="Dick">
  <Name>Dick</Name>
  </Child>
  <Child name="John">
  <Name>Dick</Name>
  </Child>
  <Child name="Joe">
  <Name>Dick</Name>
  </Child>
  <Child name="Paulette">
  <Name>Paulette</Name>
  </Child>
  <Child name="Peter">
  <Name>Peter</Name>
  </Child>
  </Family>
  
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional16.xsl
  
  Index: conditional16.xsl
  ===================================================================
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: conditional16 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 9.1 -->
    <!-- Purpose: Test of compound conditions within xsl:if. -->
  
  <xsl:template match="Family">
    <out>
      <xsl:for-each select="*">  
        <xsl:if test="@name='John'or @name='Joe'">
        <xsl:value-of select="@name"/> Smith</xsl:if><xsl:text>
  </xsl:text>  
      </xsl:for-each>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional17.xml
  
  Index: conditional17.xml
  ===================================================================
  <?xml version="1.0"?>
  <doc>
    <foo>5</foo>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional17.xsl
  
  Index: conditional17.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: conditional17 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 9.2 -->
    <!-- Creator: David Marston -->
    <!-- Purpose: Test that only the content of the first matching xsl:when is 
instantiated. -->
  
  <xsl:template match="doc">
    <out>
      <xsl:choose>
        <xsl:when test="foo &lt; 2">1</xsl:when>
        <xsl:when test="foo &lt; 4">2</xsl:when>
        <xsl:when test="foo &lt; 8">3</xsl:when>
        <xsl:when test="foo &lt; 16">4</xsl:when>
        <xsl:when test="foo &lt; 32">5</xsl:when>
        <xsl:otherwise>0</xsl:otherwise>
      </xsl:choose>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional18.xml
  
  Index: conditional18.xml
  ===================================================================
  <?xml version="1.0"?> 
  <letters>
    <letter>a</letter>
    <letter>b</letter>
    <letter>c</letter>
    <letter>f</letter>
    <letter>h</letter>
  </letters>
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional18.xsl
  
  Index: conditional18.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: conditional18 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 9.1 -->
    <!-- Creator: David Marston -->
    <!-- Purpose: Test that xsl:if can be nested. -->
  
  <xsl:template match="letters">
    <out>
      <xsl:apply-templates select="letter"/>
    </out>
  </xsl:template>
  
  <xsl:template match="letter">
    <xsl:if test="2+2 = 4">
      <xsl:if test="'d'='d'">
        <xsl:if test=".='b'">
          <xsl:if test="0 = 0">
            <xsl:if test=".='b'">
              <xsl:if test="name(..)='letters'">
                <xsl:if test="1+1 = 2">
                  <xsl:text>Found b!</xsl:text>
                </xsl:if>
              </xsl:if>
            </xsl:if>
          </xsl:if>
        </xsl:if>
      </xsl:if>
    </xsl:if>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional19.xml
  
  Index: conditional19.xml
  ===================================================================
  <?xml version="1.0"?>
  <doc>
    <title>Test for source tree numbering</title>
    <a>
      <title>Level A</title>
      <b>
        <title>Level B</title>
      </b>
      <b>
        <title>Level B</title>
        <c>
          <title>Level C</title>
        </c>
      </b>
      <b>
        <title>Level B</title>
        <c>
          <title>Level C</title>
          <d>
            <title>Level D</title>
          </d>
        </c>
      </b>
    </a>
    <a>
      <title>Level A</title>
      <b>
        <title>Level B</title>
        <c>
          <title>Level C</title>
        </c>
        <c>
          <title>Level C</title>
        </c>
        <c>
          <title>Level C</title>
          <d>
            <title>Level D</title>
            <e>
              <title>Level E</title>
            </e>
          </d>
        </c>
      </b>
    </a>
    <a>
      <title>Level A</title>
      <b>
        <title>Level B</title>
        <c>
          <title>Level C</title>
          <d>
            <title>Level D</title>
          </d>
          <d>
            <title>Level D</title>
            <e>
              <title>Level E</title>
            </e>
          </d>
          <d>
            <title>Level D</title>
            <e>
              <title>Level E</title>
            </e>
          </d>
        </c>
        <c>
          <title>Level C</title>
        </c>
        <c>
          <title>Level C</title>
          <d>
            <title>Level D</title>
          </d>
        </c>
        <c>
          <title>Level C</title>
        </c>
      </b>
      <b>
        <title>Level B</title>
      </b>
    </a>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional19.xsl
  
  Index: conditional19.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: conditional19 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 9.2 -->
    <!-- Creator: David Marston -->
    <!-- Purpose: Test that xsl:choose can be nested. -->
  
  <xsl:template match="/doc">
    <out>
      <xsl:for-each select=".//title">
        <xsl:choose>
          <xsl:when test=".='Level A'">*A+</xsl:when>
          <xsl:when test=".='Level B'">B+</xsl:when>
          <xsl:when test=".='Level C'">
            <xsl:choose><!-- When on a C, look ahead -->
              <xsl:when test="name(following-sibling::*[1])='d'">C+</xsl:when>
              <xsl:when 
test="name(../following-sibling::*[1])='c'">C:</xsl:when>
              <xsl:when 
test="name(../../following-sibling::*[1])='b'">C-</xsl:when>
              <xsl:otherwise>!Bad tree!</xsl:otherwise>
            </xsl:choose>
          </xsl:when>
          <xsl:when test=".='Level D'">
            <xsl:choose><!-- When on a D, look ahead -->
              <xsl:when test="name(following-sibling::*[1])='e'">D+</xsl:when>
              <xsl:when 
test="name(../following-sibling::*[1])='d'">D:</xsl:when>
              <xsl:otherwise><!-- We're backing up, but how far? -->
                <xsl:choose>
                  <xsl:when 
test="name(../../following-sibling::*[1])='c'">D-</xsl:when>
                  <xsl:otherwise>D|</xsl:otherwise>
                </xsl:choose>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:when>
          <xsl:when test=".='Level E'">E-</xsl:when>
          <xsl:otherwise>TREE: </xsl:otherwise>
        </xsl:choose>
      </xsl:for-each>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional20.xml
  
  Index: conditional20.xml
  ===================================================================
  <?xml version="1.0"?>
  <doc>
    <foo>
      <test/>
    </foo>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/conditional/conditional01.xml
  
  Index: conditional01.xml
  ===================================================================
  <?xml version="1.0"?>
  <doc>
    <person><sex>M</sex><name>John</name></person>
    <person><sex>F</sex><name>Jane</name></person>
    <person><sex>H</sex><name>Hermaphrodite</name></person>
    <person><sex>12</sex><name>Prince</name></person>
  </doc>
  
  

Reply via email to