gpt4 book ai didi

net.sf.saxon.expr.XPathContextMajor.setCurrentTemplateRule()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-20 19:55:40 25 4
gpt4 key购买 nike

本文整理了Java中net.sf.saxon.expr.XPathContextMajor.setCurrentTemplateRule()方法的一些代码示例,展示了XPathContextMajor.setCurrentTemplateRule()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XPathContextMajor.setCurrentTemplateRule()方法的具体详情如下:
包路径:net.sf.saxon.expr.XPathContextMajor
类名称:XPathContextMajor
方法名:setCurrentTemplateRule

XPathContextMajor.setCurrentTemplateRule介绍

[英]Set the current template. This is used to support xsl:apply-imports. The caller is responsible for remembering the previous current template and resetting it after use.
[中]设置当前模板。这用于支持xsl:apply导入。调用方负责记住以前的当前模板,并在使用后重置它。

代码示例

代码示例来源:origin: org.opengis.cite.saxon/saxon9

/**
 * Process this template, with the possibility of returning a tail call package if the template
 * contains any tail calls that are to be performed by the caller.
 * @param context the XPath dynamic context
 * @param rule the template rule that caused this template to be invoked. When a template has
 * a match pattern defined as a union, there can be more than one Rule referring to the same template,
 * and further calls on next-match or apply-imports need to know which one in in force
 * @return null if the template exited normally; but if it was a tail call, details of the call
 * that hasn't been made yet and needs to be made by the caller
*/
public TailCall applyLeavingTail(XPathContext context, Rule rule) throws XPathException {
  if (body==null) {
    // fast path for an empty template
    return null;
  }
  XPathContextMajor c2 = context.newContext();
  c2.setOrigin(this);
  c2.setCurrentTemplateRule(rule);
  if (bodyIsTailCallReturner) {
    return ((TailCallReturner)body).processLeavingTail(c2);
  } else {
    body.process(c2);
    return null;
  }
}

代码示例来源:origin: net.sf.saxon/Saxon-B

/**
 * Process this template, with the possibility of returning a tail call package if the template
 * contains any tail calls that are to be performed by the caller.
 * @param context the XPath dynamic context
 * @param rule the template rule that caused this template to be invoked. When a template has
 * a match pattern defined as a union, there can be more than one Rule referring to the same template,
 * and further calls on next-match or apply-imports need to know which one in in force
 * @return null if the template exited normally; but if it was a tail call, details of the call
 * that hasn't been made yet and needs to be made by the caller
*/
public TailCall applyLeavingTail(XPathContext context, Rule rule) throws XPathException {
  if (body==null) {
    // fast path for an empty template
    return null;
  }
  XPathContextMajor c2 = context.newContext();
  c2.setOrigin(this);
  c2.setCurrentTemplateRule(rule);
  if (bodyIsTailCallReturner) {
    return ((TailCallReturner)body).processLeavingTail(c2);
  } else {
    body.process(c2);
    return null;
  }
}

代码示例来源:origin: net.sourceforge.saxon/saxon

/**
 * Process this template, with the possibility of returning a tail call package if the template
 * contains any tail calls that are to be performed by the caller.
 * @param context the XPath dynamic context
 * @param rule the template rule that caused this template to be invoked. When a template has
 * a match pattern defined as a union, there can be more than one Rule referring to the same template,
 * and further calls on next-match or apply-imports need to know which one in in force
 * @return null if the template exited normally; but if it was a tail call, details of the call
 * that hasn't been made yet and needs to be made by the caller
*/
public TailCall applyLeavingTail(XPathContext context, Rule rule) throws XPathException {
  if (body==null) {
    // fast path for an empty template
    return null;
  }
  XPathContextMajor c2 = context.newContext();
  c2.setOriginatingConstructType(Location.TEMPLATE);
  c2.setCurrentTemplateRule(rule);
  if (bodyIsTailCallReturner) {
    return ((TailCallReturner)body).processLeavingTail(c2);
  } else {
    body.process(c2);
    return null;
  }
}

代码示例来源:origin: org.opengis.cite.saxon/saxon9

/**
 * Return an Iterator to iterate over the values of the sequence. 
 *
 * @exception XPathException if any dynamic error occurs evaluating the
 *     expression
 * @param context supplies the context for evaluation
 * @return a SequenceIterator that can be used to iterate over the result
 *     of the expression
 */
public SequenceIterator iterate(XPathContext context) throws XPathException {
  SequenceIterator master = select.iterate(context);
  XPathContextMajor c2 = context.newContext();
  c2.setOrigin(this);
  c2.setCurrentTemplateRule(null);
  c2.setCurrentIterator(master);
  master = new ContextMappingIterator(this, c2);
  return master;
}

代码示例来源:origin: net.sourceforge.saxon/saxon

/**
 * Return an Iterator to iterate over the values of the sequence. 
 *
 * @exception XPathException if any dynamic error occurs evaluating the
 *     expression
 * @param context supplies the context for evaluation
 * @return a SequenceIterator that can be used to iterate over the result
 *     of the expression
 */
public SequenceIterator iterate(XPathContext context) throws XPathException {
  SequenceIterator master = select.iterate(context);
  XPathContextMajor c2 = context.newContext();
  c2.setOrigin(this);
  c2.setCurrentTemplateRule(null);
  c2.setCurrentIterator(master);
  master = new ContextMappingIterator(this, c2);
  return master;
}

代码示例来源:origin: net.sf.saxon/Saxon-HE

/**
 * Return an Iterator to iterate over the values of a sequence. The value of every
 * expression can be regarded as a sequence, so this method is supported for all
 * expressions. This default implementation relies on the process() method: it
 * "pushes" the results of the instruction to a sequence in memory, and then
 * iterates over this in-memory sequence.
 * <p>In principle instructions should implement a pipelined iterate() method that
 * avoids the overhead of intermediate storage.</p>
 *
 * @param context supplies the context for evaluation
 * @return a SequenceIterator that can be used to iterate over the result
 *         of the expression
 * @throws XPathException if any dynamic error occurs evaluating the
 *                        expression
 */
/*@NotNull*/
public SequenceIterator<?> iterate(XPathContext context) throws XPathException {
  GroupIterator master = getGroupIterator(context);
  XPathContextMajor c2 = context.newContext();
  c2.setOrigin(this);
  c2.trackFocus(master);
  c2.setCurrentGroupIterator(master);
  c2.setCurrentTemplateRule(null);
  return new ContextMappingIterator<>(this, c2);
}

代码示例来源:origin: net.sourceforge.saxon/saxon

/**
 * Return an Iterator to iterate over the values of a sequence. The value of every
 * expression can be regarded as a sequence, so this method is supported for all
 * expressions. This default implementation relies on the process() method: it
 * "pushes" the results of the instruction to a sequence in memory, and then
 * iterates over this in-memory sequence.
 * <p/>
 * In principle instructions should implement a pipelined iterate() method that
 * avoids the overhead of intermediate storage.
 *
 * @param context supplies the context for evaluation
 * @return a SequenceIterator that can be used to iterate over the result
 *         of the expression
 * @throws XPathException if any dynamic error occurs evaluating the
 *                        expression
 */
public SequenceIterator iterate(XPathContext context) throws XPathException {
  GroupIterator master = getGroupIterator(context);
  XPathContextMajor c2 = context.newContext();
  c2.setOrigin(this);
  c2.setCurrentIterator(master);
  c2.setCurrentGroupIterator(master);
  c2.setCurrentTemplateRule(null);
  return new ContextMappingIterator(this, c2);
}

代码示例来源:origin: org.opengis.cite.saxon/saxon9

/**
 * Return an Iterator to iterate over the values of a sequence. The value of every
 * expression can be regarded as a sequence, so this method is supported for all
 * expressions. This default implementation relies on the process() method: it
 * "pushes" the results of the instruction to a sequence in memory, and then
 * iterates over this in-memory sequence.
 * <p/>
 * In principle instructions should implement a pipelined iterate() method that
 * avoids the overhead of intermediate storage.
 *
 * @param context supplies the context for evaluation
 * @return a SequenceIterator that can be used to iterate over the result
 *         of the expression
 * @throws XPathException if any dynamic error occurs evaluating the
 *                        expression
 */
public SequenceIterator iterate(XPathContext context) throws XPathException {
  GroupIterator master = getGroupIterator(context);
  XPathContextMajor c2 = context.newContext();
  c2.setOrigin(this);
  c2.setCurrentIterator(master);
  c2.setCurrentGroupIterator(master);
  c2.setCurrentTemplateRule(null);
  return new ContextMappingIterator(this, c2);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon

/**
 * Return an Iterator to iterate over the values of a sequence. The value of every
 * expression can be regarded as a sequence, so this method is supported for all
 * expressions. This default implementation relies on the process() method: it
 * "pushes" the results of the instruction to a sequence in memory, and then
 * iterates over this in-memory sequence.
 * <p>In principle instructions should implement a pipelined iterate() method that
 * avoids the overhead of intermediate storage.</p>
 *
 * @param context supplies the context for evaluation
 * @return a SequenceIterator that can be used to iterate over the result
 *         of the expression
 * @throws XPathException if any dynamic error occurs evaluating the
 *                        expression
 */
/*@NotNull*/
public SequenceIterator<?> iterate(XPathContext context) throws XPathException {
  GroupIterator master = getGroupIterator(context);
  XPathContextMajor c2 = context.newContext();
  c2.setOrigin(this);
  c2.trackFocus(master);
  c2.setCurrentGroupIterator(master);
  c2.setCurrentTemplateRule(null);
  return new ContextMappingIterator<>(this, c2);
}

代码示例来源:origin: net.sf.saxon/Saxon-HE

/**
   * Process the template call encapsulated by this package.
   *
   * @return another TailCall. This will never be the original call, but it may be the next
   *         recursive call. For example, if A calls B which calls C which calls D, then B may return
   *         a TailCall to A representing the call from B to C; when this is processed, the result may be
   *         a TailCall representing the call from C to D.
   * @throws XPathException if a dynamic error occurs
   */
  public TailCall processLeavingTail() throws XPathException {
    TemplateRule nh = (TemplateRule) rule.getAction();
    nh.initialize();
    XPathContextMajor c2 = evaluationContext.newContext();
    c2.setOrigin(NextMatch.this);
    //c2.setOriginatingConstructType(LocationKind.TEMPLATE);
    c2.setLocalParameters(params);
    c2.setTunnelParameters(tunnelParams);
    c2.openStackFrame(nh.getStackFrameMap());
    c2.setCurrentTemplateRule(rule);
    c2.setCurrentComponent(evaluationContext.getCurrentComponent());
    // System.err.println("Tail call on template");
    return nh.applyLeavingTail(c2);
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon

/**
   * Process the template call encapsulated by this package.
   *
   * @return another TailCall. This will never be the original call, but it may be the next
   *         recursive call. For example, if A calls B which calls C which calls D, then B may return
   *         a TailCall to A representing the call from B to C; when this is processed, the result may be
   *         a TailCall representing the call from C to D.
   * @throws XPathException if a dynamic error occurs
   */
  public TailCall processLeavingTail() throws XPathException {
    TemplateRule nh = (TemplateRule) rule.getAction();
    nh.initialize();
    XPathContextMajor c2 = evaluationContext.newContext();
    c2.setOrigin(NextMatch.this);
    //c2.setOriginatingConstructType(LocationKind.TEMPLATE);
    c2.setLocalParameters(params);
    c2.setTunnelParameters(tunnelParams);
    c2.openStackFrame(nh.getStackFrameMap());
    c2.setCurrentTemplateRule(rule);
    c2.setCurrentComponent(evaluationContext.getCurrentComponent());
    // System.err.println("Tail call on template");
    return nh.applyLeavingTail(c2);
  }
}

代码示例来源:origin: net.sourceforge.saxon/saxon

c2.setOrigin(this);
c2.setCurrentIterator(iter);
c2.setCurrentTemplateRule(null);

代码示例来源:origin: org.opengis.cite.saxon/saxon9

public TailCall processLeavingTail(XPathContext context) throws XPathException {
  Controller controller = context.getController();
  SequenceIterator iter = select.iterate(context);
  XPathContextMajor c2 = context.newContext();
  c2.setOrigin(this);
  c2.setCurrentIterator(iter);
  c2.setCurrentTemplateRule(null);
  if (controller.isTracing()) {
    TraceListener listener = controller.getTraceListener();
    while(true) {
      Item item = iter.next();
      if (item == null) {
        break;
      }
      listener.startCurrentItem(item);
      action.process(c2);
      listener.endCurrentItem(item);
    }
  } else {
    while(true) {
      Item item = iter.next();
      if (item == null) {
        break;
      }
      action.process(c2);
    }
  }
  return null;
}

代码示例来源:origin: net.sourceforge.saxon/saxon

public TailCall processLeavingTail(XPathContext context) throws XPathException {
  Controller controller = context.getController();
  GroupIterator groupIterator = getGroupIterator(context);
  XPathContextMajor c2 = context.newContext();
  c2.setOrigin(this);
  c2.setCurrentIterator(groupIterator);
  c2.setCurrentGroupIterator(groupIterator);
  c2.setCurrentTemplateRule(null);
  if (controller.isTracing()) {
    TraceListener listener = controller.getTraceListener();
    while (true) {
      Item item = groupIterator.next();
      if (item == null) {
        break;
      }
      listener.startCurrentItem(item);
      action.process(c2);
      listener.endCurrentItem(item);
    }
  } else {
    while (true) {
      Item item = groupIterator.next();
      if (item == null) {
        break;
      }
      action.process(c2);
    }
  }
  return null;
}

代码示例来源:origin: org.opengis.cite.saxon/saxon9

public TailCall processLeavingTail(XPathContext context) throws XPathException {
  Controller controller = context.getController();
  GroupIterator groupIterator = getGroupIterator(context);
  XPathContextMajor c2 = context.newContext();
  c2.setOrigin(this);
  c2.setCurrentIterator(groupIterator);
  c2.setCurrentGroupIterator(groupIterator);
  c2.setCurrentTemplateRule(null);
  if (controller.isTracing()) {
    TraceListener listener = controller.getTraceListener();
    while (true) {
      Item item = groupIterator.next();
      if (item == null) {
        break;
      }
      listener.startCurrentItem(item);
      action.process(c2);
      listener.endCurrentItem(item);
    }
  } else {
    while (true) {
      Item item = groupIterator.next();
      if (item == null) {
        break;
      }
      action.process(c2);
    }
  }
  return null;
}

代码示例来源:origin: net.sf.saxon/Saxon-HE

public TailCall processLeavingTail(XPathContext context) throws XPathException {
  Controller controller = context.getController();
  assert controller != null;
  PipelineConfiguration pipe = context.getReceiver().getPipelineConfiguration();
  GroupIterator groupIterator = getGroupIterator(context);
  XPathContextMajor c2 = context.newContext();
  c2.setOrigin(this);
  FocusIterator focusIterator = c2.trackFocus(groupIterator);
  c2.setCurrentGroupIterator(groupIterator);
  c2.setCurrentTemplateRule(null);
  pipe.setXPathContext(c2);
  if (controller.isTracing()) {
    TraceListener listener = controller.getTraceListener();
    assert listener != null;
    Item item;
    while ((item = focusIterator.next()) != null) {
      listener.startCurrentItem(item);
      getActionExpression().process(c2);
      listener.endCurrentItem(item);
    }
  } else {
    while (focusIterator.next() != null) {
      getActionExpression().process(c2);
    }
  }
  pipe.setXPathContext(context);
  return null;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon

public TailCall processLeavingTail(XPathContext context) throws XPathException {
  Controller controller = context.getController();
  assert controller != null;
  PipelineConfiguration pipe = context.getReceiver().getPipelineConfiguration();
  GroupIterator groupIterator = getGroupIterator(context);
  XPathContextMajor c2 = context.newContext();
  c2.setOrigin(this);
  FocusIterator focusIterator = c2.trackFocus(groupIterator);
  c2.setCurrentGroupIterator(groupIterator);
  c2.setCurrentTemplateRule(null);
  pipe.setXPathContext(c2);
  if (controller.isTracing()) {
    TraceListener listener = controller.getTraceListener();
    assert listener != null;
    Item item;
    while ((item = focusIterator.next()) != null) {
      listener.startCurrentItem(item);
      getActionExpression().process(c2);
      listener.endCurrentItem(item);
    }
  } else {
    while (focusIterator.next() != null) {
      getActionExpression().process(c2);
    }
  }
  pipe.setXPathContext(context);
  return null;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon

c2.setTunnelParameters(tunnels);
c2.openStackFrame(nh.getStackFrameMap());
c2.setCurrentTemplateRule(rule);
c2.setCurrentComponent(modeComponent);
nh.apply(c2);

代码示例来源:origin: net.sf.saxon/Saxon-HE

c2.setTunnelParameters(tunnels);
c2.openStackFrame(nh.getStackFrameMap());
c2.setCurrentTemplateRule(rule);
c2.setCurrentComponent(modeComponent);
nh.apply(c2);

代码示例来源:origin: net.sf.saxon/Saxon-HE

c2.setOrigin(this);
FocusIterator<?> iter = c2.trackFocus(getSelect().iterate(context));
c2.setCurrentTemplateRule(null);

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com