You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by jo...@apache.org on 2004/12/13 20:58:11 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/templates ElemApplyImport.java

joannet     2004/12/13 11:58:11

  Modified:    java/src/org/apache/xalan/transformer TransformerImpl.java
               java/src/org/apache/xalan/templates ElemApplyImport.java
  Log:
  fixed jira 1824, changed current template rule when named template executes an xsl:apply-imports
  
  Revision  Changes    Path
  1.159     +13 -11    xml-xalan/java/src/org/apache/xalan/transformer/TransformerImpl.java
  
  Index: TransformerImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/TransformerImpl.java,v
  retrieving revision 1.158
  retrieving revision 1.159
  diff -u -r1.158 -r1.159
  --- TransformerImpl.java	23 Feb 2004 21:33:14 -0000	1.158
  +++ TransformerImpl.java	13 Dec 2004 19:58:11 -0000	1.159
  @@ -2051,7 +2051,7 @@
      * template and process the contents.
      *
      * @param xslInstruction The calling element.
  -   * @param template The template to use if xsl:for-each, or null.
  +   * @param template The template to use if xsl:for-each, current template for apply-imports, or null.
      * @param child The source context node.
      * @param mode The current mode, may be null.
      * @throws TransformerException
  @@ -2066,22 +2066,23 @@
       DTM dtm = m_xcontext.getDTM(child);
       short nodeType = dtm.getNodeType(child);
       boolean isDefaultTextRule = false;
  -    boolean isApplyImports = false;    
  +    boolean isApplyImports = false;
  +    
  +    isApplyImports = ((xslInstruction == null)
  +                                ? false
  +                                : xslInstruction.getXSLToken()
  +                                  == Constants.ELEMNAME_APPLY_IMPORTS);        
   
  -    if (null == template)
  +    if (null == template || isApplyImports)
       {
         int maxImportLevel, endImportLevel=0;
  -      isApplyImports = ((xslInstruction == null)
  -                                ? false
  -                                : xslInstruction.getXSLToken()
  -                                  == Constants.ELEMNAME_APPLY_IMPORTS);
   
         if (isApplyImports)
         {
           maxImportLevel =
  -          xslInstruction.getStylesheetComposed().getImportCountComposed() - 1;
  +          template.getStylesheetComposed().getImportCountComposed() - 1;
           endImportLevel =
  -          xslInstruction.getStylesheetComposed().getEndImportCountComposed();
  +          template.getStylesheetComposed().getEndImportCountComposed();
         }
         else
         {
  @@ -2216,8 +2217,9 @@
         m_xcontext.popCurrentNode();
         if (!isApplyImports) {
             m_xcontext.popContextNodeList();
  -          popCurrentMatched();
         }
  +      popCurrentMatched();
  +      
         popElemTemplateElement();
       }
   
  
  
  
  1.16      +4 -5      xml-xalan/java/src/org/apache/xalan/templates/ElemApplyImport.java
  
  Index: ElemApplyImport.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemApplyImport.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- ElemApplyImport.java	17 Aug 2004 18:35:32 -0000	1.15
  +++ ElemApplyImport.java	13 Dec 2004 19:58:11 -0000	1.16
  @@ -83,10 +83,9 @@
       int sourceNode = transformer.getXPathContext().getCurrentNode();
       if (DTM.NULL != sourceNode)
       {
  -
  -      // This will have to change to current template, (which will have 
  -      // to be the top of a current template stack).
  -      transformer.applyTemplateToNode(this, null, sourceNode);
  +      // supply the current templated (matched, not named)        
  +      ElemTemplate matchTemplate = transformer.getMatchedTemplate();
  +      transformer.applyTemplateToNode(this, matchTemplate, sourceNode);
       }
       else  // if(null == sourceNode)
       {
  
  
  

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