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 2001/09/19 18:26:35 UTC

cvs commit: xml-xalan/test/tests/conf/string string139.xsl string136.xsl string137.xml string137.xsl string138.xml string138.xsl string139.xml string136.xml

dmarston    01/09/19 09:26:35

  Added:       test/tests/conf/string string139.xsl string136.xsl
                        string137.xml string137.xsl string138.xml
                        string138.xsl string139.xml string136.xml
  Log:
  More coverage of the translate() function.
  
  Revision  Changes    Path
  1.1                  xml-xalan/test/tests/conf/string/string139.xsl
  
  Index: string139.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
    <!-- FileName: string138 -->
    <!-- Document: http://www.w3.org/TR/xpath -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 4.2 String Functions -->
    <!-- Creator: David Marston -->
    <!-- Purpose: Use 'translate()' to change certain characters to quotes and apostrophes. -->
  
  <xsl:template match="/doc">
    <out>
      <!-- The output string to translate() contains both a quote and an apostrophe.
        Since only one of those two can be treated as data in one string constant,
        we build up the string from two variables, using opposite double-quoting on each. -->
      <xsl:variable name="pt1" select='"aqu&apos;"'/>
      <xsl:variable name="pt2" select="'&quot;eos'"/>
      <xsl:value-of select="translate(a,'AQU-+EOS',concat($pt1,$pt2))"/>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  1.1                  xml-xalan/test/tests/conf/string/string136.xsl
  
  Index: string136.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
    <!-- FileName: string136 -->
    <!-- Document: http://www.w3.org/TR/xpath -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 4.2 String Functions -->
    <!-- Creator: David Marston -->
    <!-- Purpose: Ensure that 'translate()' doesn't loop on characters that get repositioned -->
  
  <xsl:template match="/doc">
    <out>
      <xsl:value-of select='translate(a,"abe","bao")'/>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  1.1                  xml-xalan/test/tests/conf/string/string137.xml
  
  Index: string137.xml
  ===================================================================
  <?xml version="1.0"?> 
  <doc>
    <a>barbarity</a>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/string/string137.xsl
  
  Index: string137.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
    <!-- FileName: string137 -->
    <!-- Document: http://www.w3.org/TR/xpath -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 4.2 String Functions -->
    <!-- Creator: David Marston -->
    <!-- Purpose: Use 'translate()' to map several characters to the same one. -->
  
  <xsl:template match="/doc">
    <out>
      <xsl:value-of select='translate(a,"aeiouy","******")'/>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  1.1                  xml-xalan/test/tests/conf/string/string138.xml
  
  Index: string138.xml
  ===================================================================
  <?xml version="1.0"?> 
  <doc>
    <a><![CDATA[qua'lit"y]]></a>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/string/string138.xsl
  
  Index: string138.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  
    <!-- FileName: string138 -->
    <!-- Document: http://www.w3.org/TR/xpath -->
    <!-- DocVersion: 19991116 -->
    <!-- Section: 4.2 String Functions -->
    <!-- Creator: David Marston -->
    <!-- Purpose: Use 'translate()' to change quotes and apostrophes to other characters. -->
  
  <xsl:template match="/doc">
    <out>
      <!-- The input string to translate() contains both a quote and an apostrophe.
        Since only one of those two can be treated as data in one string constant,
        we build up the string from two variables, using opposite double-quoting on each. -->
      <xsl:variable name="pt1" select='"aqu&apos;"'/>
      <xsl:variable name="pt2" select="'&quot;eos'"/>
      <xsl:value-of select="translate(a,concat($pt1,$pt2),'AQU-+EOS')"/>
    </out>
  </xsl:template>
  
  </xsl:stylesheet>
  
  
  1.1                  xml-xalan/test/tests/conf/string/string139.xml
  
  Index: string139.xml
  ===================================================================
  <?xml version="1.0"?> 
  <doc>
    <a>quan+ti-ty</a>
  </doc>
  
  
  1.1                  xml-xalan/test/tests/conf/string/string136.xml
  
  Index: string136.xml
  ===================================================================
  <?xml version="1.0"?> 
  <doc>
    <a>barter</a>
  </doc>
  
  

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