dmarston    02/05/09 12:51:39

  Added:       test/tests/conf/position position97.xsl position95.xsl
                        position96.xml position96.xsl position97.xml
                        position95.xml
  Log:
  New cases inspired by bugs, notably #8805.
  
  Revision  Changes    Path
  1.1                  xml-xalan/test/tests/conf/position/position97.xsl
  
  Index: position97.xsl
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: position97 -->
    <!-- Document: http://www.w3.org/TR/xpath -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 4.1 -->
    <!-- Creator: Joerg Heinicke, trimmed by David Marston -->
    <!-- Purpose: Use a (number-valued) variable in a predicate, but inside a 
for-each. -->
  
  <xsl:output method="xml" indent="no" encoding="UTF-8"/>
  
  <xsl:template match="root">
    <out>
    <xsl:text>
  </xsl:text>
      <xsl:apply-templates select="base//description"/>
    </out>
  </xsl:template>
    
  <xsl:template match="description">
    <xsl:variable name="pos" select="position()"/>
    <tr row="{$pos}">
      <xsl:for-each select="/root/base">
        <td>
          <xsl:copy-of select="@side"/>
          <xsl:value-of select=".//description[$pos]"/>
        </td>
      </xsl:for-each>
    </tr>
    <xsl:text>
  </xsl:text>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/position/position95.xsl
  
  Index: position95.xsl
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: position95 -->
    <!-- Document: http://www.w3.org/TR/xpath -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 2.4 -->
    <!-- Creator: Paul Dick -->
    <!-- Purpose: Test position in a union in a match pattern -->
  
  <xsl:output method="xml" indent="no" encoding="UTF-8"/>
  
  <xsl:template match="doc">
    <out>
      <xsl:apply-templates select="descendant::*"/>
    </out>
  </xsl:template>
  
  <xsl:template match="alpha|z">
    <xsl:text>
  </xsl:text>
    <xsl:value-of select="@key"/>
    <xsl:text> is at position </xsl:text>
    <xsl:value-of select="position()"/>
  </xsl:template>
  
  <xsl:template match="beta"/><!-- Squelch these -->
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/position/position96.xml
  
  Index: position96.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <doc>
    <a>1</a>
    <a>2</a>
    <a>3</a>
    <a>4</a>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/position/position96.xsl
  
  Index: position96.xsl
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0">
  
    <!-- FileName: position96 -->
    <!-- Document: http://www.w3.org/TR/xpath -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 4.1 -->
    <!-- Creator: David Marston -->
    <!-- Purpose: Use just a (number-valued) global variable in a predicate. -->
  
  <xsl:output method="xml" indent="no" encoding="UTF-8"/>
  
  <xsl:variable name="third" select="3"/>
  
  <xsl:template match="doc">
    <out>
      <xsl:value-of select="a[$third]"/>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/position/position97.xml
  
  Index: position97.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <root>
   <base side="left">
    <a>
     <description>a1</description>
    </a>
    <a>
     <description>a2</description>
     <b>
      <description>a2b1</description>
     </b>
     <b>
      <description>a2b2</description>
     </b>
    </a>
   </base>
   <base side="right">
    <a>
     <description>a3</description>
     <b>
      <description>a3b1</description>
     </b>
    </a>
    <a>
     <description>a4</description>
    </a>
    <a>
     <description>a5</description>
     <b>
      <description>a5b1</description>
     </b>
    </a>
   </base>
  </root>
  
  
  1.1                  xml-xalan/test/tests/conf/position/position95.xml
  
  Index: position95.xml
  ===================================================================
  <doc>
    <alpha key="a">
      <z key="a1"/>
    </alpha>
    <alpha key="b">
      <beta key="b1"/>
      <z key="b2"/>
    </alpha>
    <alpha key="c">
      <z key="c1"/>
      <z key="c2"/>
      <beta key="c2"/>
      <z key="c4"/>
    </alpha>
  </doc>
  
  

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

Reply via email to