/**
   * Apply the context node to the matching templates.
   *
   * @see <a
   *     href="http://www.w3.org/TR/xslt#section-Applying-Template-Rules">section-Applying-Template-Rules
   *     in XSLT Specification</a>
   * @param transformer non-null reference to the the current transform-time state.
   * @param sourceNode non-null reference to the <a
   *     href="http://www.w3.org/TR/xslt#dt-current-node">current source node</a>.
   * @param mode reference, which may be null, to the <a
   *     href="http://www.w3.org/TR/xslt#modes">current mode</a>.
   * @throws TransformerException
   */
  public void execute(TransformerImpl transformer) throws TransformerException {

    transformer.pushCurrentTemplateRuleIsNull(false);

    boolean pushMode = false;

    try {
      // %REVIEW% Do we need this check??
      //      if (null != sourceNode)
      //      {
      // boolean needToTurnOffInfiniteLoopCheck = false;
      QName mode = transformer.getMode();

      if (!m_isDefaultTemplate) {
        if (((null == mode) && (null != m_mode)) || ((null != mode) && !mode.equals(m_mode))) {
          pushMode = true;

          transformer.pushMode(m_mode);
        }
      }
      if (TransformerImpl.S_DEBUG) transformer.getTraceManager().fireTraceEvent(this);

      transformSelectedNodes(transformer);
    } finally {
      if (TransformerImpl.S_DEBUG) transformer.getTraceManager().fireTraceEndEvent(this);

      if (pushMode) transformer.popMode();

      transformer.popCurrentTemplateRuleIsNull();
    }
  }
Beispiel #2
0
  /**
   * Execute the xsl:for-each transformation
   *
   * @param transformer non-null reference to the the current transform-time state.
   * @throws TransformerException
   */
  public void execute(TransformerImpl transformer) throws TransformerException {

    transformer.pushCurrentTemplateRuleIsNull(true);
    if (transformer.getDebug())
      transformer.getTraceManager().fireTraceEvent(this); // trigger for-each element event

    try {
      transformSelectedNodes(transformer);
    } finally {
      if (transformer.getDebug()) transformer.getTraceManager().fireTraceEndEvent(this);
      transformer.popCurrentTemplateRuleIsNull();
    }
  }