Package org.apache.xalan.transformer

Examples of org.apache.xalan.transformer.StackGuard


      ResultTreeHandler rth = transformer.getResultTreeHandler();
      StylesheetRoot sroot = getStylesheetRoot();
      TemplateList tl = sroot.getTemplateListComposed();

      // StylesheetComposed stylesheet = getStylesheetComposed();
      StackGuard guard = transformer.getStackGuard();
      boolean check = (guard.m_recursionLimit > -1);
      boolean quiet = transformer.getQuietConflictWarnings();
      boolean needToFindTemplate = (null == template);
     
      try
      {
        Node child;

        while (null != (child = sourceNodes.nextNode()))
        {
          if (needToFindTemplate)
          {
            template = tl.getTemplate(xctxt, child, mode, -1, quiet);

            // 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 (child.getNodeType())
              {
              case Node.DOCUMENT_FRAGMENT_NODE :
              case Node.ELEMENT_NODE :
                template = sroot.getDefaultRule();
                break;
              case Node.ATTRIBUTE_NODE :
              case Node.CDATA_SECTION_NODE :
              case Node.TEXT_NODE :
                if (child.isSupported(SaxEventDispatch.SUPPORTSINTERFACE, "1.0"))
                {
                  ((SaxEventDispatch) child).dispatchCharactersEvent(rth);
                }
                else
                {
                  String data = child.getNodeValue();
                  rth.characters(data.toCharArray(), 0, data.length());
                }
                continue;
              case Node.DOCUMENT_NODE :
                template = sroot.getDefaultRootRule();
                break;
              default :

                // No default rules for processing instructions and the like.
                continue;
              }
            }
          }

          // If we are processing the default text rule, then just clone
          // the value directly to the result tree.
          try
          {
            transformer.pushPairCurrentMatched(template, child);

            if (check)
              guard.push(this, child);

            // Fire a trace event for the template.
            if (rdebug)
              transformer.getTraceManager().fireTraceEvent(child, mode,
                                                           template);

            // And execute the child templates.
            if (template.isCompiledTemplate())
              template.execute(transformer, child, mode);
            else
            {

              // Loop through the children of the template, calling execute on
              // each of them.
              for (ElemTemplateElement t = template.m_firstChild; t != null;
                   t = t.m_nextSibling)
              {
                xctxt.setSAXLocator(t);
                transformer.setCurrentElement(t);
                t.execute(transformer, child, mode);
              }
            }
            reMarkParams(xctxt);
          }
          catch(TransformerException te)
          {
            throw te;
          }
          finally
          {
            transformer.popCurrentMatched();

            if (check)
              guard.pop();
          }
        }
      }
      finally
      {
View Full Code Here

TOP

Related Classes of org.apache.xalan.transformer.StackGuard

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.