sboag       01/06/12 06:19:55

  Modified:    java/src/org/apache/xalan/templates Tag: DTM_EXP
                        ElemApplyTemplates.java ElemChoose.java
                        ElemCopyOf.java ElemForEach.java ElemIf.java
                        ElemValueOf.java
               java/src/org/apache/xalan/trace Tag: DTM_EXP
                        TraceManager.java
               java/src/org/apache/xalan/transformer Tag: DTM_EXP
                        TransformerImpl.java
  Added:       java/src/org/apache/xalan/trace Tag: DTM_EXP
                        EndSelectionEvent.java TraceListenerEx.java
  Log:
  Reworked the new end select trace interface a bit, so that
  there won't be a problem with backwards compatibility.
  Added TraceListenerEx, which has a selectEnd event, and EndSelectionEvent.  
Added
  fireSelectedEndEvent event to the trace manager.  This event
  is thrown only from ElemForEach and ElemApplyTemplates.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.13.2.6  +10 -4     
xml-xalan/java/src/org/apache/xalan/templates/ElemApplyTemplates.java
  
  Index: ElemApplyTemplates.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemApplyTemplates.java,v
  retrieving revision 1.13.2.5
  retrieving revision 1.13.2.6
  diff -u -r1.13.2.5 -r1.13.2.6
  --- ElemApplyTemplates.java   2001/06/11 20:16:12     1.13.2.5
  +++ ElemApplyTemplates.java   2001/06/12 13:19:48     1.13.2.6
  @@ -257,10 +257,6 @@
       try
       {
   
  -      //      if (TransformerImpl.S_DEBUG)
  -      //        transformer.getTraceManager().fireSelectedEvent(sourceNode, 
this,
  -      //                          "test", m_selectExpression,
  -      //                          new 
org.apache.xpath.objects.XNodeSet(sourceNodes));
         final Vector keys = (m_sortElems == null)
                             ? null
                             : transformer.processSortKeys(this, sourceNode);
  @@ -269,6 +265,11 @@
         if (null != keys)
           sourceNodes = sortNodes(xctxt, keys, sourceNodes);
   
  +      if (TransformerImpl.S_DEBUG)
  +        transformer.getTraceManager().fireSelectedEvent(sourceNode, this,
  +                "select", new XPath(m_selectExpression),
  +                new org.apache.xpath.objects.XNodeSet(sourceNodes));
  +
         final ResultTreeHandler rth = transformer.getResultTreeHandler();
         ContentHandler chandler = rth.getContentHandler();
         final StylesheetRoot sroot = transformer.getStylesheet();
  @@ -428,6 +429,11 @@
       }
       finally
       {
  +      if (TransformerImpl.S_DEBUG)
  +        transformer.getTraceManager().fireSelectedEndEvent(sourceNode, this,
  +                "select", new XPath(m_selectExpression),
  +                new org.apache.xpath.objects.XNodeSet(sourceNodes));
  +
         if(nParams > 0)
           vars.unlink();
         xctxt.popSAXLocator();
  
  
  
  1.9.2.5   +4 -3      
xml-xalan/java/src/org/apache/xalan/templates/ElemChoose.java
  
  Index: ElemChoose.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemChoose.java,v
  retrieving revision 1.9.2.4
  retrieving revision 1.9.2.5
  diff -u -r1.9.2.4 -r1.9.2.5
  --- ElemChoose.java   2001/06/11 20:16:13     1.9.2.4
  +++ ElemChoose.java   2001/06/12 13:19:48     1.9.2.5
  @@ -157,9 +157,10 @@
               return;
             }
   
  -          if (TransformerImpl.S_DEBUG)
  -            transformer.getTraceManager().fireSelectedEvent(sourceNode, when,
  -                    "endTest", when.getTest(), test);
  +          // I don't think we want this.  -sb
  +          //  if (TransformerImpl.S_DEBUG)
  +          //    transformer.getTraceManager().fireSelectedEvent(sourceNode, 
when,
  +          //            "endTest", when.getTest(), test);
           }
           else if (when.getTest().bool(xctxt, sourceNode, when))
           {
  
  
  
  1.10.2.6  +6 -5      
xml-xalan/java/src/org/apache/xalan/templates/ElemCopyOf.java
  
  Index: ElemCopyOf.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemCopyOf.java,v
  retrieving revision 1.10.2.5
  retrieving revision 1.10.2.6
  diff -u -r1.10.2.5 -r1.10.2.6
  --- ElemCopyOf.java   2001/06/11 20:16:13     1.10.2.5
  +++ ElemCopyOf.java   2001/06/12 13:19:48     1.10.2.6
  @@ -183,7 +183,7 @@
         ResultTreeHandler handler = transformer.getResultTreeHandler();
   
         if (null != value)
  -                     {
  +                        {
           int type = value.getType();
           String s;
   
  @@ -243,10 +243,11 @@
             break;
           }
         }
  -                     
  -                     if (TransformerImpl.S_DEBUG)
  -        transformer.getTraceManager().fireSelectedEvent(sourceNode, this,
  -                                                        "endSelect", 
m_selectExpression, value);
  +                        
  +      // I don't think we want this.  -sb
  +      //  if (TransformerImpl.S_DEBUG)
  +      //  transformer.getTraceManager().fireSelectedEvent(sourceNode, this,
  +      //  "endSelect", m_selectExpression, value);
   
       }
       catch(org.xml.sax.SAXException se)
  
  
  
  1.20.2.11 +63 -44    
xml-xalan/java/src/org/apache/xalan/templates/ElemForEach.java
  
  Index: ElemForEach.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemForEach.java,v
  retrieving revision 1.20.2.10
  retrieving revision 1.20.2.11
  diff -u -r1.20.2.10 -r1.20.2.11
  --- ElemForEach.java  2001/06/11 20:16:14     1.20.2.10
  +++ ElemForEach.java  2001/06/12 13:19:49     1.20.2.11
  @@ -116,15 +116,15 @@
      * @serial
      */
     protected Expression m_selectExpression = null;
  -        
  -         /**
  +
  +  /**
      * Set the "select" attribute.
      *
      * @param xpath The XPath expression for the "select" attribute.
      */
     public void setSelect(XPath xpath)
     {
  -                m_selectExpression = xpath.getExpression();
  +    m_selectExpression = xpath.getExpression();
     }
   
     /**
  @@ -136,52 +136,62 @@
     {
       return m_selectExpression;
     }
  -  
  +
     /**
      * This function is called after everything else has been
      * recomposed, and allows the template to set remaining
      * values that may be based on some other property that
      * depends on recomposition.
  +   *
  +   * NEEDSDOC @param sroot
  +   *
  +   * @throws TransformerException
      */
     public void compose(StylesheetRoot sroot) throws TransformerException
     {
  +
       super.compose(sroot);
  +
       int length = getSortElemCount();
  -    for (int i = 0; i < length; i++) 
  +
  +    for (int i = 0; i < length; i++)
       {
         getSortElem(i).compose(sroot);
       }
  +
       java.util.Vector vnames = sroot.getComposeState().getVariableNames();
  -    if(null != m_selectExpression)
  -      m_selectExpression.fixupVariables(vnames, 
sroot.getComposeState().getGlobalsSize());
  +
  +    if (null != m_selectExpression)
  +      m_selectExpression.fixupVariables(
  +        vnames, sroot.getComposeState().getGlobalsSize());
       else
       {
  -                        m_selectExpression =
  +      m_selectExpression =
           getStylesheetRoot().m_selectDefault.getExpression();
       }
     }
   
  -//  /**
  -//   * This function is called after everything else has been
  -//   * recomposed, and allows the template to set remaining
  -//   * values that may be based on some other property that
  -//   * depends on recomposition.
  -//   *
  -//   * @throws TransformerException
  -//   */
  -//  public void compose() throws TransformerException
  -//  {
  -//
  -//    if (null == m_selectExpression)
  -//    {
  -//      m_selectExpression =
  -//        getStylesheetRoot().m_selectDefault.getExpression();
  -//    }
  -//  }
  +  //  /**
  +  //   * This function is called after everything else has been
  +  //   * recomposed, and allows the template to set remaining
  +  //   * values that may be based on some other property that
  +  //   * depends on recomposition.
  +  //   *
  +  //   * @throws TransformerException
  +  //   */
  +  //  public void compose() throws TransformerException
  +  //  {
  +  //
  +  //    if (null == m_selectExpression)
  +  //    {
  +  //      m_selectExpression =
  +  //        getStylesheetRoot().m_selectDefault.getExpression();
  +  //    }
  +  //  }
   
     /**
      * Vector containing the xsl:sort elements associated with this element.
  -   *  @serial         
  +   *  @serial
      */
     protected Vector m_sortElems = null;
   
  @@ -323,64 +333,68 @@
      * @throws TransformerException Thrown in a variety of circumstances.
      */
     public void transformSelectedNodes(TransformerImpl transformer)
  -            throws TransformerException
  +          throws TransformerException
     {
   
       final XPathContext xctxt = transformer.getXPathContext();
       final int sourceNode = xctxt.getCurrentNode();
  -    DTMIterator sourceNodes = m_selectExpression.asIterator(xctxt, 
sourceNode);
  +    DTMIterator sourceNodes = m_selectExpression.asIterator(xctxt,
  +                                sourceNode);
   
       try
       {
   
  -      if (TransformerImpl.S_DEBUG)
  -              transformer.getTraceManager().fireSelectedEvent(sourceNode, 
this,
  -              "test", new XPath(m_selectExpression),
  -                                                                             
                                                                                
                                                 new 
org.apache.xpath.objects.XNodeSet(sourceNodes));
         final Vector keys = (m_sortElems == null)
  -            ? null
  -            : transformer.processSortKeys(this, sourceNode);
  +                          ? null
  +                          : transformer.processSortKeys(this, sourceNode);
   
         // Sort if we need to.
         if (null != keys)
           sourceNodes = sortNodes(xctxt, keys, sourceNodes);
   
  +      if (TransformerImpl.S_DEBUG)
  +        transformer.getTraceManager().fireSelectedEvent(sourceNode, this,
  +                "select", new XPath(m_selectExpression),
  +                new org.apache.xpath.objects.XNodeSet(sourceNodes));
  +
         final ResultTreeHandler rth = transformer.getResultTreeHandler();
         ContentHandler chandler = rth.getContentHandler();
  -      
  +
         xctxt.pushCurrentNode(DTM.NULL);
  +
         int[] currentNodes = xctxt.getCurrentNodeStack();
         int currentNodePos = xctxt.getCurrentNodeFirstFree() - 1;
  -      
  +
         xctxt.pushCurrentExpressionNode(DTM.NULL);
  +
         int[] currentExpressionNodes = xctxt.getCurrentExpressionNodeStack();
  -      int currentExpressionNodePos = 
xctxt.getCurrentExpressionNodesFirstFree() - 1;
  +      int currentExpressionNodePos =
  +        xctxt.getCurrentExpressionNodesFirstFree() - 1;
   
         xctxt.pushSAXLocatorNull();
         xctxt.pushContextNodeList(sourceNodes);
         transformer.pushElemTemplateElement(null);
  -      // pushParams(transformer, xctxt);
   
  +      // pushParams(transformer, xctxt);
         // Should be able to get this from the iterator but there must be a 
bug.
         DTM dtm = xctxt.getDTM(sourceNode);
         int docID = sourceNode & DTMManager.IDENT_DTM_DEFAULT;
  -      
         int child;
  +
         while (DTM.NULL != (child = sourceNodes.nextNode()))
         {
           currentNodes[currentNodePos] = child;
           currentExpressionNodes[currentExpressionNodePos] = child;
   
  -        if((child & DTMManager.IDENT_DTM_DEFAULT) != docID)
  +        if ((child & DTMManager.IDENT_DTM_DEFAULT) != docID)
           {
             dtm = xctxt.getDTM(child);
             docID = sourceNode & DTMManager.IDENT_DTM_DEFAULT;
           }
  -        
  +
           final int exNodeType = dtm.getExpandedTypeID(child);
           final int nodeType = (exNodeType >> 
ExpandedNameTable.ROTAMOUNT_TYPE);
   
  -
           // Fire a trace event for the template.
           if (TransformerImpl.S_DEBUG)
             transformer.getTraceManager().fireTraceEvent(this);
  @@ -388,8 +402,8 @@
           // And execute the child templates.
           // Loop through the children of the template, calling execute on 
           // each of them.
  -        for (ElemTemplateElement t = this.m_firstChild; 
  -             t != null; t = t.m_nextSibling)
  +        for (ElemTemplateElement t = this.m_firstChild; t != null;
  +                t = t.m_nextSibling)
           {
             xctxt.setSAXLocator(t);
             transformer.setCurrentElement(t);
  @@ -399,6 +413,11 @@
       }
       finally
       {
  +      if (TransformerImpl.S_DEBUG)
  +        transformer.getTraceManager().fireSelectedEndEvent(sourceNode, this,
  +                "select", new XPath(m_selectExpression),
  +                new org.apache.xpath.objects.XNodeSet(sourceNodes));
  +
         xctxt.popSAXLocator();
         xctxt.popContextNodeList();
         transformer.popElemTemplateElement();
  
  
  
  1.9.2.4   +4 -3      xml-xalan/java/src/org/apache/xalan/templates/ElemIf.java
  
  Index: ElemIf.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemIf.java,v
  retrieving revision 1.9.2.3
  retrieving revision 1.9.2.4
  diff -u -r1.9.2.3 -r1.9.2.4
  --- ElemIf.java       2001/06/11 20:16:15     1.9.2.3
  +++ ElemIf.java       2001/06/12 13:19:49     1.9.2.4
  @@ -190,9 +190,10 @@
           transformer.executeChildTemplates(this, true);
         }
   
  -      if (TransformerImpl.S_DEBUG)
  -        transformer.getTraceManager().fireSelectedEvent(sourceNode, this,
  -                "endTest", m_test, test);
  +      // I don't think we want this.  -sb
  +      //  if (TransformerImpl.S_DEBUG)
  +      //    transformer.getTraceManager().fireSelectedEvent(sourceNode, this,
  +      //            "endTest", m_test, test);
       }
       else if (m_test.bool(xctxt, sourceNode, this))
       {
  
  
  
  1.13.2.9  +2 -5      
xml-xalan/java/src/org/apache/xalan/templates/ElemValueOf.java
  
  Index: ElemValueOf.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemValueOf.java,v
  retrieving revision 1.13.2.8
  retrieving revision 1.13.2.9
  diff -u -r1.13.2.8 -r1.13.2.9
  --- ElemValueOf.java  2001/06/11 20:16:19     1.13.2.8
  +++ ElemValueOf.java  2001/06/12 13:19:49     1.13.2.9
  @@ -280,10 +280,6 @@
           try
           {
             dtm.dispatchCharactersEvents(child, rth, false);
  -
  -          //if (TransformerImpl.S_DEBUG)
  -          //  transformer.getTraceManager().fireSelectedEvent(child, this,
  -          //          "select", m_selectExpression, value);
           }
           finally
           {
  @@ -314,9 +310,10 @@
             {
               XObject obj = expr.execute(xctxt);
   
  -            obj.dispatchCharactersEvents(rth);
               transformer.getTraceManager().fireSelectedEvent(current, this,
                       "select", m_selectExpression, obj);
  +
  +            obj.dispatchCharactersEvents(rth);
             }
             else
             {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.7.2.4   +69 -15    
xml-xalan/java/src/org/apache/xalan/trace/TraceManager.java
  
  Index: TraceManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/trace/TraceManager.java,v
  retrieving revision 1.7.2.3
  retrieving revision 1.7.2.4
  diff -u -r1.7.2.3 -r1.7.2.4
  --- TraceManager.java 2001/06/08 19:02:03     1.7.2.3
  +++ TraceManager.java 2001/06/12 13:19:52     1.7.2.4
  @@ -74,7 +74,7 @@
   public class TraceManager
   {
   
  -  /** A transformer instance          */
  +  /** A transformer instance */
     private TransformerImpl m_transformer;
   
     /**
  @@ -164,13 +164,14 @@
      */
     public void fireTraceEvent(ElemTemplateElement styleNode)
     {
  -  
  +
       if (hasTraceListeners())
       {
  -                     int sourceNode = 
m_transformer.getXPathContext().getCurrentNode();
  -                     Node source = 
m_transformer.getXPathContext().getDTM(sourceNode).getNode(sourceNode);
  -    
  -      fireTraceEvent(new TracerEvent(m_transformer, source, null, 
/*sourceNode, mode,*/
  +      int sourceNode = m_transformer.getXPathContext().getCurrentNode();
  +      Node source = m_transformer.getXPathContext().getDTM(
  +        sourceNode).getNode(sourceNode);
  +
  +      fireTraceEvent(new TracerEvent(m_transformer, source, null,  
/*sourceNode, mode,*/
                                        styleNode));
       }
     }
  @@ -201,25 +202,78 @@
      *
      * @param sourceNode Current source node
      * @param styleNode node in the style tree reference for the event.
  -   * @param attributeName The attribute name from which the selection is 
made. 
  +   * @param attributeName The attribute name from which the selection is 
made.
      * @param xpath The XPath that executed the selection.
      * @param selection The result of the selection.
      *
      * @throws javax.xml.transform.TransformerException
      */
     public void fireSelectedEvent(
  -          int sourceNode, ElemTemplateElement styleNode, String 
attributeName, XPath xpath, XObject selection)
  +          int sourceNode, ElemTemplateElement styleNode, String 
attributeName, 
  +          XPath xpath, XObject selection)
               throws javax.xml.transform.TransformerException
     {
   
       if (hasTraceListeners())
  -             {
  -                     Node source = 
m_transformer.getXPathContext().getDTM(sourceNode).getNode(sourceNode);
  -    
  -      fireSelectedEvent(new SelectionEvent(m_transformer, source,
  -                                           styleNode, attributeName, xpath,
  -                                           selection));
  -             }
  +    {
  +      Node source = m_transformer.getXPathContext().getDTM(
  +        sourceNode).getNode(sourceNode);
  +
  +      fireSelectedEvent(new SelectionEvent(m_transformer, source, styleNode,
  +                                           attributeName, xpath, selection));
  +    }
  +  }
  +  
  +  /**
  +   * Fire a selection event.
  +   *
  +   * @param sourceNode Current source node
  +   * @param styleNode node in the style tree reference for the event.
  +   * @param attributeName The attribute name from which the selection is 
made.
  +   * @param xpath The XPath that executed the selection.
  +   * @param selection The result of the selection.
  +   *
  +   * @throws javax.xml.transform.TransformerException
  +   */
  +  public void fireSelectedEndEvent(
  +          int sourceNode, ElemTemplateElement styleNode, String 
attributeName, 
  +          XPath xpath, XObject selection)
  +            throws javax.xml.transform.TransformerException
  +  {
  +
  +    if (hasTraceListeners())
  +    {
  +      Node source = m_transformer.getXPathContext().getDTM(
  +        sourceNode).getNode(sourceNode);
  +
  +      fireSelectedEndEvent(new EndSelectionEvent(m_transformer, source, 
styleNode,
  +                                           attributeName, xpath, selection));
  +    }
  +  }
  +  
  +  /**
  +   * Fire a selection event.
  +   *
  +   * @param se Selection event to fire
  +   *
  +   * @throws javax.xml.transform.TransformerException
  +   */
  +  public void fireSelectedEndEvent(EndSelectionEvent se)
  +          throws javax.xml.transform.TransformerException
  +  {
  +
  +    if (hasTraceListeners())
  +    {
  +      int nListeners = m_traceListeners.size();
  +
  +      for (int i = 0; i < nListeners; i++)
  +      {
  +        TraceListener tl = (TraceListener) m_traceListeners.elementAt(i);
  +
  +        if(tl instanceof TraceListenerEx)
  +          ((TraceListenerEx)tl).selectEnd(se);
  +      }
  +    }
     }
   
     /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +37 -0     
xml-xalan/java/src/org/apache/xalan/trace/Attic/EndSelectionEvent.java
  
  
  
  
  1.1.2.1   +20 -0     
xml-xalan/java/src/org/apache/xalan/trace/Attic/TraceListenerEx.java
  
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.90.2.21 +10 -242   
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.90.2.20
  retrieving revision 1.90.2.21
  diff -u -r1.90.2.20 -r1.90.2.21
  --- TransformerImpl.java      2001/06/11 20:16:32     1.90.2.20
  +++ TransformerImpl.java      2001/06/12 13:19:54     1.90.2.21
  @@ -540,8 +540,8 @@
     {
       return m_hasTransformThreadErrorCatcher;
     }
  -     
  -     /**
  +        
  +        /**
      * Process the source tree to SAX parse events.
      * @param source  The input for the source tree.
      *
  @@ -549,8 +549,8 @@
      */
     public void transform(Source source) throws TransformerException
     {
  -             transform(source, true); 
  -     }
  +                transform(source, true); 
  +        }
   
     /**
      * Process the source tree to SAX parse events.
  @@ -574,8 +574,8 @@
         }
         finally
         {
  -                             if (shouldRelease)
  -                                     mgr.release(dtm, hardDelete);
  +                                if (shouldRelease)
  +                                        mgr.release(dtm, hardDelete);
         }
   
         // Kick off the parse.  When the ContentHandler gets 
  @@ -1128,8 +1128,8 @@
   
       return handler;
     }
  -     
  -     /**
  +        
  +        /**
      * Process the source tree to the output result.
      * @param xmlSource  The input for the source tree.
      * @param outputTarget The output source target.
  @@ -1139,8 +1139,8 @@
     public void transform(Source xmlSource, Result outputTarget)
             throws TransformerException
     {
  -             transform(xmlSource, outputTarget, true);
  -     }
  +                transform(xmlSource, outputTarget, true);
  +        }
   
     /**
      * Process the source tree to the output result.
  @@ -2056,238 +2056,6 @@
       return true;
     }
     
  -// Experemental... but causes bugs that I don't want to track down 
  -// right now. -sb
  -//  /**
  -//   * <meta name="usage" content="advanced"/>
  -//   * Perform a query if needed, and call transformNode for each child.
  -//   *
  -//   * @param caller The calling for-each template.
  -//   * @param template The owning template context.
  -//   *
  -//   * @throws TransformerException Thrown in a variety of circumstances.
  -//   */
  -//  public void transformSelectedNodes(
  -//          ElemForEach caller, ElemTemplateElement template)
  -//            throws TransformerException
  -//  {
  -//
  -//    final XPathContext xctxt = m_xcontext;
  -//    final int sourceNode = xctxt.getCurrentNode();
  -//    DTMIterator sourceNodes = caller.getSelect().asIterator(xctxt, 
sourceNode);
  -//
  -//    try
  -//    {
  -//
  -//      //      if (TransformerImpl.S_DEBUG)
  -//      //        
transformer.getTraceManager().fireSelectedEvent(sourceNode, this,
  -//      //                          "test", m_selectExpression,
  -//      //                          new 
org.apache.xpath.objects.XNodeSet(sourceNodes));
  -//      final Vector keys = (caller.getSortElemCount() > 0)
  -//                          ? null
  -//                          : processSortKeys(caller, sourceNode);
  -//
  -//      // Sort if we need to.
  -//      if (null != keys)
  -//        sourceNodes = caller.sortNodes(xctxt, keys, sourceNodes);
  -//
  -//      final ResultTreeHandler rth = getResultTreeHandler();
  -//      ContentHandler chandler = rth.getContentHandler();
  -//      final TemplateList tl = m_stylesheetRoot.getTemplateListComposed();
  -//      final boolean needToFindTemplate = (null == template);
  -//      final boolean quiet = m_quietConflictWarnings;
  -//      
  -//      xctxt.pushCurrentNode(DTM.NULL);
  -//      int[] currentNodes = xctxt.getCurrentNodeStack();
  -//      int currentNodePos = xctxt.getCurrentNodeFirstFree() - 1;
  -//      
  -//      xctxt.pushCurrentExpressionNode(DTM.NULL);
  -//      int[] currentExpressionNodes = xctxt.getCurrentExpressionNodeStack();
  -//      int currentExpressionNodePos = 
xctxt.getCurrentExpressionNodesFirstFree() - 1;
  -//
  -//      // StylesheetComposed stylesheet = getStylesheetComposed();
  -//      boolean didSetVars = false;
  -//      SourceLocator savedLocator = null;
  -//      boolean check = false;
  -//      int savedSearchStart = 0;
  -//
  -//      try
  -//      {
  -//        // Should be able to get this from the iterator but there must be 
a bug.
  -//        DTM dtm = xctxt.getDTM(sourceNode);
  -//        int docID = sourceNode & DTMManager.IDENT_DTM_DEFAULT;
  -//        
  -//        int child;
  -//        while (DTM.NULL != (child = sourceNodes.nextNode()))
  -//        {
  -//          currentNodes[currentNodePos] = child;
  -//          currentExpressionNodes[currentExpressionNodePos] = child;
  -//
  -//          if((child & DTMManager.IDENT_DTM_DEFAULT) != docID)
  -//          {
  -//            dtm = xctxt.getDTM(child);
  -//            docID = sourceNode & DTMManager.IDENT_DTM_DEFAULT;
  -//          }
  -//          
  -//          final int exNodeType = dtm.getExpandedTypeID(child);
  -//          final int nodeType = (exNodeType >> 
ExpandedNameTable.ROTAMOUNT_TYPE);
  -//
  -//          if (needToFindTemplate)
  -//          {
  -//            final QName mode = getMode();
  -//
  -//            template = tl.getTemplateFast(xctxt, child, exNodeType, mode, 
  -//                                          -1, quiet, dtm);
  -//
  -//            // If that didn't locate a node, fall back to a default 
template rule.
  -//            // See http://www.w3.org/TR/xslt#built-in-rule.
  -//            if (null == template)
  -//            {
  -//              switch (nodeType)
  -//              {
  -//              case DTM.DOCUMENT_FRAGMENT_NODE :
  -//              case DTM.ELEMENT_NODE :
  -//                template = m_stylesheetRoot.getDefaultRule();
  -//                break;
  -//              case DTM.ATTRIBUTE_NODE :
  -//              case DTM.CDATA_SECTION_NODE :
  -//              case DTM.TEXT_NODE :
  -//                rth.flushPending(true);
  -//                dtm.dispatchCharactersEvents(child, chandler, false);
  -//                continue;
  -//              case DTM.DOCUMENT_NODE :
  -//                template = m_stylesheetRoot.getDefaultRootRule();
  -//                break;
  -//              default :
  -//
  -//                // No default rules for processing instructions and the 
like.
  -//                continue;
  -//              }
  -//            }
  -//          }
  -//
  -//          if (!didSetVars)
  -//          {
  -//            didSetVars = true;
  -//            check = (m_stackGuard.m_recursionLimit > -1);
  -//
  -//            savedLocator = xctxt.getSAXLocator();
  -//
  -//            xctxt.pushContextNodeList(sourceNodes);
  -//            pushElemTemplateElement(null);
  -//
  -//            savedSearchStart = caller.pushParams(this, xctxt);
  -//          }
  -//
  -//          ElemTemplateElement t = template.getFirstChildElem();
  -//
  -//          // If we are processing the default text rule, then just clone 
  -//          // the value directly to the result tree.
  -//          try
  -//          {
  -//            if (needToFindTemplate)
  -//              pushPairCurrentMatched(template, child);
  -//
  -//            if (check)
  -//              m_stackGuard.push(caller, child);
  -//
  -//            // Fire a trace event for the template.
  -//            if (TransformerImpl.S_DEBUG)
  -//              getTraceManager().fireTraceEvent(template);
  -//
  -//            // And execute the child templates.
  -//            // Loop through the children of the template, calling execute 
on 
  -//            // each of them.
  -//            for (; t != null; t = t.getNextSiblingElem())
  -//            {
  -//              xctxt.setSAXLocator(t);
  -//              setCurrentElement(t);
  -//
  -//              switch (t.getXSLToken())
  -//              {
  -//              case Constants.ELEMNAME_COPY :
  -//              
  -//                if ((DTM.DOCUMENT_NODE != nodeType)
  -//                        && (DTM.DOCUMENT_FRAGMENT_NODE != nodeType))
  -//                {
  -//                  // TODO: Process the use-attribute-sets stuff
  -//
  -//                  if (DTM.ELEMENT_NODE == nodeType)
  -//                  {
  -//                    String ns = dtm.getNamespaceURI(child);
  -//                    String localName = dtm.getLocalName(child);
  -//                    String qname = dtm.getNodeNameX(child);
  -//          
  -//                    rth.startElement(ns, localName, qname, null);
  -//
  -//                    if(null != ((ElemUse)t).getUseAttributeSets())
  -//                      ((ElemUse)t).applyAttrSets(this, m_stylesheetRoot);
  -//                      
  -//                    rth.processNSDecls(child, nodeType, dtm);
  -//                    executeChildTemplates(t, true);
  -//
  -//                    rth.endElement(ns, localName, qname);
  -//                  }
  -//                  else
  -//                  {
  -//                    ClonerToResultTree.cloneToResultTree(child, nodeType, 
  -//                                                         dtm, rth, false);
  -//                    if (TransformerImpl.S_DEBUG)
  -//                      getTraceManager().fireTraceEvent(t);
  -//                  }
  -//                }
  -//                else
  -//                {
  -//                  if (TransformerImpl.S_DEBUG)
  -//                    getTraceManager().fireTraceEvent(t);
  -//
  -//                  if(null != ((ElemUse)t).getUseAttributeSets())
  -//                    ((ElemUse)t).applyAttrSets(this, m_stylesheetRoot);
  -//                  executeChildTemplates(t, true);
  -//                }
  -//                break;
  -//              default :
  -//                t.execute(this);
  -//              }
  -//            }
  -//            if(savedSearchStart > 0)
  -//              caller.reMarkParams(xctxt);
  -//          }
  -//          finally
  -//          {
  -//            if (needToFindTemplate)
  -//              popCurrentMatched();
  -//
  -//            if (check)
  -//              m_stackGuard.pop();
  -//          }
  -//        }
  -//      }
  -//      finally
  -//      {
  -//        if (didSetVars)
  -//        {
  -//          xctxt.setSAXLocator(savedLocator);
  -//          xctxt.popContextNodeList();
  -//          popElemTemplateElement();
  -//          caller.popParams(xctxt, savedSearchStart);
  -//        }
  -//
  -//        // if(null != sourceNodes)
  -//        //  sourceNodes.detach();                
  -//      }
  -//    }
  -//    catch (SAXException se)
  -//    {
  -//      getErrorListener().fatalError(new TransformerException(se));
  -//    }
  -//    finally
  -//    {
  -//      xctxt.popCurrentExpressionNode();
  -//      xctxt.popCurrentNode();
  -//      sourceNodes.detach();
  -//    }
  -//  }
     
     /**
      * <meta name="usage" content="advanced"/>
  
  
  

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

Reply via email to