curcuru     01/10/18 15:32:21

  Added:       test/tests/contrib/var var03.xsl var03.xml
  Log:
  Variation on a theme of Bugzilla#4218: apply-templates modes instead of 
call-template
  
  Revision  Changes    Path
  1.1                  xml-xalan/test/tests/contrib/var/var03.xsl
  
  Index: var03.xsl
  ===================================================================
  <?xml version="1.0" encoding="utf-8"?>
  <xsl:stylesheet 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    version="1.0">   
  <!-- var02.xsl: variations on a theme:Bugzilla#4218 related stylesheets-->
  
  <xsl:template match="doc">
      <out>
        <!-- Variables declared at same level as call-template -->
        <xsl:variable name="v1" select="'abc-should-appear-once'"/>
        <xsl:variable name="v2" select="'def-should-appear-once'"/>
        
        <xsl:call-template name="template1">
          <!-- Param name is same in all cases -->
          <xsl:with-param name="param1">
            <!-- Theme change: apply-templates instead of call-template -->
            <xsl:apply-templates mode="singleton">
              <xsl:with-param name="param1" select="$v1"/>
            </xsl:apply-templates>
            <xsl:value-of select="$v2"/>
          </xsl:with-param>
        </xsl:call-template>
      </out>
    </xsl:template>
   
    <xsl:template name="template1">
      <xsl:param name="param1" select="'error'"/>
      <template1><xsl:value-of select="$param1"/></template1>
    </xsl:template>
   
    <xsl:template name="template2" match="//singleton" mode="singleton">
      <xsl:param name="param1" select="'error'"/>
      <template2><xsl:value-of select="$param1"/></template2>
    </xsl:template>
    <xsl:template match="text()" mode="singleton"/>
    
  </xsl:stylesheet>
  
  
  1.1                  xml-xalan/test/tests/contrib/var/var03.xml
  
  Index: var03.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <doc>
  <list number="1">
    <item number="1">one</item>
    <item number="2">two</item>
    <item number="3">three</item>
  </list>
  <singleton/>
  <list number="2">
    <item number="a">aaa</item>
    <item number="b">bbb</item>
  </list>
  </doc>
  
  

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

Reply via email to