You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by dm...@apache.org on 2002/05/09 23:11:54 UTC

cvs commit: xml-xalan/test/tests/conf/variable var70imp.xsl variable67.xml variable67.xsl variable68.xml variable68.xsl variable69.xml variable69.xsl variable70.xml variable70.xsl

dmarston    02/05/09 14:11:54

  Added:       test/tests/conf/variable var70imp.xsl variable67.xml
                        variable67.xsl variable68.xml variable68.xsl
                        variable69.xml variable69.xsl variable70.xml
                        variable70.xsl
  Log:
  Assorted new cases. 67 is for bug #7118.
  
  Revision  Changes    Path
  1.1                  xml-xalan/test/tests/conf/variable/var70imp.xsl
  
  Index: var70imp.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
    <!-- FileName: var70imp -->
    <!-- Purpose: to be imported by variable70 -->
  
  <xsl:variable name="foo">
    <xsl:value-of select="/doc/foo"/>
  </xsl:variable>
  
  </xsl:stylesheet>
  
  
  
  1.1                  xml-xalan/test/tests/conf/variable/variable67.xml
  
  Index: variable67.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <doc/>
  
  
  1.1                  xml-xalan/test/tests/conf/variable/variable67.xsl
  
  Index: variable67.xsl
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
    <!-- FileName: variable67 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 11.6 -->
    <!-- Creator: David Marston, from Roman Stawski's bug report (#7118) -->
    <!-- Purpose: Setting a variable in the midst of setting another should not alter any others -->
  
  <xsl:output method="xml" indent="no" encoding="ISO-8859-1"/>
  
  <!-- Two global variables: index should be unaffected; source contains settings for others -->
  <xsl:variable name="index" select="'okay'"/>
  
  <xsl:variable name="source">
    <xsl:text>
  (Before) </xsl:text><xsl:value-of select="$index"/>
    <xsl:variable name="joke1" select="'error'" />
    <xsl:text>
  (Between) </xsl:text><xsl:value-of select="$index"/>
    <xsl:variable name="joke2" select="'bug'"/>
    <xsl:text>
  (After) </xsl:text><xsl:value-of select="$index"/>
  </xsl:variable>
  
  <xsl:template match="doc">
    <out>
      <Start><xsl:value-of select="$index"/></Start>
      <xsl:value-of select="$source"/>
      <xsl:text>
  </xsl:text>
      <End><xsl:value-of select="$index"/></End>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  1.1                  xml-xalan/test/tests/conf/variable/variable68.xml
  
  Index: variable68.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <doc>
    <a>value</a>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/variable/variable68.xsl
  
  Index: variable68.xsl
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
    <!-- FileName: variable68 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 11.6 -->
    <!-- Creator: David Marston -->
    <!-- Purpose: Demonstrate various tests of nullness on local variables -->
  
  <xsl:output method="xml" indent="no" encoding="UTF-8"/>
  
  <xsl:template match="doc">
    <xsl:variable name="NotSet"/>
    <xsl:variable name="String" select="'string'"/>
    <xsl:variable name="nString" select="''"/>
    <xsl:variable name="Node" select="a"/>
    <xsl:variable name="nNode" select="b"/><!-- No element of that name in source. -->
    <out>
      <xsl:text>NotSet: </xsl:text>
      <xsl:choose>
        <xsl:when test="$NotSet = ''"><xsl:text>equals empty</xsl:text></xsl:when>
        <xsl:when test="$NotSet != ''"><xsl:text>not empty</xsl:text></xsl:when>
        <xsl:otherwise><xsl:text>neither</xsl:text></xsl:otherwise>
      </xsl:choose>
      <xsl:text>
  String: </xsl:text>
      <xsl:choose>
        <xsl:when test="$String = ''"><xsl:text>equals empty</xsl:text></xsl:when>
        <xsl:when test="$String != ''"><xsl:text>not empty</xsl:text></xsl:when>
        <xsl:otherwise><xsl:text>neither</xsl:text></xsl:otherwise>
      </xsl:choose>
      <xsl:text>
  nString: </xsl:text>
      <xsl:choose>
        <xsl:when test="$nString = ''"><xsl:text>equals empty</xsl:text></xsl:when>
        <xsl:when test="$nString != ''"><xsl:text>not empty</xsl:text></xsl:when>
        <xsl:otherwise><xsl:text>neither</xsl:text></xsl:otherwise>
      </xsl:choose>
      <xsl:text>
  Node: </xsl:text>
      <xsl:choose>
        <xsl:when test="$Node = ''"><xsl:text>equals empty</xsl:text></xsl:when>
        <xsl:when test="$Node != ''"><xsl:text>not empty</xsl:text></xsl:when>
        <xsl:otherwise><xsl:text>neither</xsl:text></xsl:otherwise>
      </xsl:choose>
      <xsl:text>
  nNode: </xsl:text>
      <xsl:choose>
        <xsl:when test="$nNode = ''"><xsl:text>equals empty</xsl:text></xsl:when>
        <xsl:when test="$nNode != ''"><xsl:text>not empty</xsl:text></xsl:when>
        <xsl:otherwise><xsl:text>neither</xsl:text></xsl:otherwise>
      </xsl:choose>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  1.1                  xml-xalan/test/tests/conf/variable/variable69.xml
  
  Index: variable69.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <doc>
    <a>value</a>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/variable/variable69.xsl
  
  Index: variable69.xsl
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
    <!-- FileName: variable69 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 11.6 -->
    <!-- Creator: David Marston -->
    <!-- Purpose: Demonstrate various tests of nullness on global variables -->
  
  <xsl:output method="xml" indent="no" encoding="UTF-8"/>
  
  <xsl:variable name="NotSet"/>
  <xsl:variable name="String" select="'string'"/>
  <xsl:variable name="nString" select="''"/>
  <xsl:variable name="Node" select="/doc/a"/>
  <xsl:variable name="nNode" select="/doc/b"/><!-- No element of that name in source. -->
  
  <xsl:template match="doc">
    <out>
      <xsl:text>NotSet: </xsl:text>
      <xsl:choose>
        <xsl:when test="$NotSet = ''"><xsl:text>equals empty</xsl:text></xsl:when>
        <xsl:when test="$NotSet != ''"><xsl:text>not empty</xsl:text></xsl:when>
        <xsl:otherwise><xsl:text>neither</xsl:text></xsl:otherwise>
      </xsl:choose>
      <xsl:text>
  String: </xsl:text>
      <xsl:choose>
        <xsl:when test="$String = ''"><xsl:text>equals empty</xsl:text></xsl:when>
        <xsl:when test="$String != ''"><xsl:text>not empty</xsl:text></xsl:when>
        <xsl:otherwise><xsl:text>neither</xsl:text></xsl:otherwise>
      </xsl:choose>
      <xsl:text>
  nString: </xsl:text>
      <xsl:choose>
        <xsl:when test="$nString = ''"><xsl:text>equals empty</xsl:text></xsl:when>
        <xsl:when test="$nString != ''"><xsl:text>not empty</xsl:text></xsl:when>
        <xsl:otherwise><xsl:text>neither</xsl:text></xsl:otherwise>
      </xsl:choose>
      <xsl:text>
  Node: </xsl:text>
      <xsl:choose>
        <xsl:when test="$Node = ''"><xsl:text>equals empty</xsl:text></xsl:when>
        <xsl:when test="$Node != ''"><xsl:text>not empty</xsl:text></xsl:when>
        <xsl:otherwise><xsl:text>neither</xsl:text></xsl:otherwise>
      </xsl:choose>
      <xsl:text>
  nNode: </xsl:text>
      <xsl:choose>
        <xsl:when test="$nNode = ''"><xsl:text>equals empty</xsl:text></xsl:when>
        <xsl:when test="$nNode != ''"><xsl:text>not empty</xsl:text></xsl:when>
        <xsl:otherwise><xsl:text>neither</xsl:text></xsl:otherwise>
      </xsl:choose>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  1.1                  xml-xalan/test/tests/conf/variable/variable70.xml
  
  Index: variable70.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <doc>
    <foo>bar</foo>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/variable/variable70.xsl
  
  Index: variable70.xsl
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
    <!-- FileName: variable70 -->
    <!-- Document: http://www.w3.org/TR/xslt -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 11.2 Values of Variables and Parameters -->
    <!-- Creator: Tom Amiro -->
    <!-- Purpose: Define global variable using a when with a dependency on a variable in an included file -->
  
  <xsl:output method="xml" indent="no" encoding="UTF-8"/>
  
  <xsl:include href="var70imp.xsl"/>
  
  <xsl:variable name="bar">
    <xsl:choose>
      <xsl:when test="$foo='bar'">
        <xsl:text>the value of bar is bar</xsl:text>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text>the value of bar is undefined</xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  
  <xsl:template match="/">
    <out>
      <xsl:value-of select="$bar"/>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org