当前位置: 首页>>代码示例>>Java>>正文


Java TransformerImpl.executeChildTemplates方法代码示例

本文整理汇总了Java中org.apache.xalan.transformer.TransformerImpl.executeChildTemplates方法的典型用法代码示例。如果您正苦于以下问题:Java TransformerImpl.executeChildTemplates方法的具体用法?Java TransformerImpl.executeChildTemplates怎么用?Java TransformerImpl.executeChildTemplates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.xalan.transformer.TransformerImpl的用法示例。


在下文中一共展示了TransformerImpl.executeChildTemplates方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: annotation

import org.apache.xalan.transformer.TransformerImpl; //导入方法依赖的package包/类
public static void annotation(XSLProcessorContext ctx, ElemExtensionCall call) throws TransformerException {
	TransformerImpl transformer = ctx.getTransformer();
	XMLReaderContext xrctx = (XMLReaderContext) transformer.getParameter(XML_READER_CONTEXT_PARAMETER);
	int start = getAttributeIntValue(ctx, call, START_ATTRNAME);
	int end = getAttributeIntValue(ctx, call, END_ATTRNAME);
	String layers0 = getAttributeStringValue(ctx, call, "xpath-layers", "layers");
	//System.err.println("a: " + start + "-" + end + " (" + layers0 + ")");
	if (layers0 == null)
		return;
	layers0 = layers0.trim();
	if (layers0.isEmpty())
		return;
	String[] layers = WHITESPACE.split(layers0);
	String ref = getAttributeStringValue(ctx, call, "xpath-ref", "ref");
	xrctx.startAnnotation(start, end, layers, ref);
	transformer.executeChildTemplates(call, false);
	xrctx.endAnnotation();
}
 
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:19,代码来源:XMLReader.java

示例2: executeFallback

import org.apache.xalan.transformer.TransformerImpl; //导入方法依赖的package包/类
/**
 * Execute the fallback elements.  This must be explicitly called to
 * instantiate the content of an xsl:fallback element.
 * When an XSLT transformer performs fallback for an instruction
 * element, if the instruction element has one or more xsl:fallback
 * children, then the content of each of the xsl:fallback children
 * must be instantiated in sequence; otherwise, an error must
 * be signaled. The content of an xsl:fallback element is a template.
 *
 * @param transformer non-null reference to the the current transform-time state.
 *
 * @throws TransformerException
 */
public void executeFallback(
        TransformerImpl transformer)
          throws TransformerException
{

  int parentElemType = m_parentNode.getXSLToken();
  if (Constants.ELEMNAME_EXTENSIONCALL == parentElemType 
      || Constants.ELEMNAME_UNDEFINED == parentElemType)
  {

    transformer.executeChildTemplates(this, true);

  }
  else
  {

    // Should never happen
    System.out.println(
      "Error!  parent of xsl:fallback must be an extension or unknown element!");
  }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:35,代码来源:ElemFallback.java

示例3: execute

import org.apache.xalan.transformer.TransformerImpl; //导入方法依赖的package包/类
/**
   * Copy the template contents into the result tree.
   * The content of the xsl:template element is the template
   * that is instantiated when the template rule is applied.
   *
   * @param transformer non-null reference to the the current transform-time state.
   *
   * @throws TransformerException
   */
  public void execute(
          TransformerImpl transformer)
            throws TransformerException
  {
    XPathContext xctxt = transformer.getXPathContext();
    
    xctxt.pushRTFContext();

      // %REVIEW% commenting out of the code below.
//    if (null != sourceNode)
//    {
      transformer.executeChildTemplates(this, true);
//    }
//    else  // if(null == sourceNode)
//    {
//      transformer.getMsgMgr().error(this,
//        this, sourceNode,
//        XSLTErrorResources.ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES);
//
//      //"sourceNode is null in handleApplyTemplatesInstruction!");
//    }

    xctxt.popRTFContext();
    }
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:34,代码来源:ElemTemplate.java

示例4: document

import org.apache.xalan.transformer.TransformerImpl; //导入方法依赖的package包/类
public static void document(XSLProcessorContext ctx, ElemExtensionCall call) throws TransformerException {
	TransformerImpl transformer = ctx.getTransformer();
	XMLReaderContext xrctx = (XMLReaderContext) transformer.getParameter(XML_READER_CONTEXT_PARAMETER);
	String id = getAttributeStringValue(ctx, call, "xpath-id", "id");
	xrctx.startDocument(id);
	transformer.executeChildTemplates(call, false);
	xrctx.endDocument();
}
 
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:9,代码来源:XMLReader.java

示例5: section

import org.apache.xalan.transformer.TransformerImpl; //导入方法依赖的package包/类
public static void section(XSLProcessorContext ctx, ElemExtensionCall call) throws TransformerException {
	TransformerImpl transformer = ctx.getTransformer();
	XMLReaderContext xrctx = (XMLReaderContext) transformer.getParameter(XML_READER_CONTEXT_PARAMETER);
	String name = getAttributeStringValue(ctx, call, "xpath-name", "name");
	String contents = getAttributeStringValue(ctx, call, "xpath-contents", "contents");
	boolean referenceScope = getAttributeBooleanValue(ctx, call, "references", true);
	xrctx.startSection(name, contents);
	if (referenceScope)
		xrctx.startRefScope();
	transformer.executeChildTemplates(call, false);
	if (referenceScope)
		xrctx.endRefScope();
	xrctx.endSection();
}
 
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:15,代码来源:XMLReader.java

示例6: relation

import org.apache.xalan.transformer.TransformerImpl; //导入方法依赖的package包/类
public static final void relation(XSLProcessorContext ctx, ElemExtensionCall call) throws TransformerException {
	TransformerImpl transformer = ctx.getTransformer();
	XMLReaderContext xrctx = (XMLReaderContext) transformer.getParameter(XML_READER_CONTEXT_PARAMETER);
	String name = getAttributeStringValue(ctx, call, "xpath-name", "name");
	xrctx.startRelation(name);
	transformer.executeChildTemplates(call, false);
	xrctx.endRelation();
}
 
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:9,代码来源:XMLReader.java

示例7: tuple

import org.apache.xalan.transformer.TransformerImpl; //导入方法依赖的package包/类
public static final void tuple(XSLProcessorContext ctx, ElemExtensionCall call) throws TransformerException {
	TransformerImpl transformer = ctx.getTransformer();
	XMLReaderContext xrctx = (XMLReaderContext) transformer.getParameter(XML_READER_CONTEXT_PARAMETER);
	xrctx.startTuple();
	transformer.executeChildTemplates(call, false);
	xrctx.endTuple();
}
 
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:8,代码来源:XMLReader.java

示例8: feature

import org.apache.xalan.transformer.TransformerImpl; //导入方法依赖的package包/类
public static void feature(XSLProcessorContext ctx, ElemExtensionCall call) throws TransformerException {
	TransformerImpl transformer = ctx.getTransformer();
	XMLReaderContext xrctx = (XMLReaderContext) transformer.getParameter(XML_READER_CONTEXT_PARAMETER);
	String name = getAttributeStringValue(ctx, call, "xpath-name", "name");
	String value = getAttributeStringValue(ctx, call, "xpath-value", "value");
	xrctx.setFeature(name, value);
	transformer.executeChildTemplates(call, false);
}
 
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:9,代码来源:XMLReader.java

示例9: references

import org.apache.xalan.transformer.TransformerImpl; //导入方法依赖的package包/类
public static void references(XSLProcessorContext ctx, ElemExtensionCall call) throws TransformerException {
	TransformerImpl transformer = ctx.getTransformer();
	XMLReaderContext xrctx = (XMLReaderContext) transformer.getParameter(XML_READER_CONTEXT_PARAMETER);
	xrctx.startRefScope();
	transformer.executeChildTemplates(call, false);
	xrctx.endRefScope();
}
 
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:8,代码来源:XMLReader.java

示例10: execute

import org.apache.xalan.transformer.TransformerImpl; //导入方法依赖的package包/类
/**
 * Conditionally execute a sub-template.
 * The expression is evaluated and the resulting object is converted
 * to a boolean as if by a call to the boolean function. If the result
 * is true, then the content template is instantiated; otherwise, nothing
 * is created.
 *
 * @param transformer non-null reference to the the current transform-time state.
 *
 * @throws TransformerException
 */
public void execute(TransformerImpl transformer) throws TransformerException
{

  XPathContext xctxt = transformer.getXPathContext();
  int sourceNode = xctxt.getCurrentNode();

    if (m_test.bool(xctxt, sourceNode, this)) {
        transformer.executeChildTemplates(this, true);
    }

}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:23,代码来源:ElemIf.java

示例11: execute

import org.apache.xalan.transformer.TransformerImpl; //导入方法依赖的package包/类
/**
 * Execute the xsl:choose transformation.
 *
 *
 * @param transformer non-null reference to the the current transform-time state.
 *
 * @throws TransformerException
 */
public void execute(TransformerImpl transformer) throws TransformerException
{

  boolean found = false;

  for (ElemTemplateElement childElem = getFirstChildElem();
          childElem != null; childElem = childElem.getNextSiblingElem())
  {
    int type = childElem.getXSLToken();

    if (Constants.ELEMNAME_WHEN == type)
    {
      found = true;

      ElemWhen when = (ElemWhen) childElem;

      // must be xsl:when
      XPathContext xctxt = transformer.getXPathContext();
      int sourceNode = xctxt.getCurrentNode();
      
      // System.err.println("\""+when.getTest().getPatternString()+"\"");
      
      // if(when.getTest().getPatternString().equals("COLLECTION/icuser/ictimezone/LITERAL='GMT +13:00 Pacific/Tongatapu'"))
      // 	System.err.println("Found COLLECTION/icuser/ictimezone/LITERAL");

        if (when.getTest().bool(xctxt, sourceNode, when)) {
            transformer.executeChildTemplates(when, true);

            return;
        }
    }
    else if (Constants.ELEMNAME_OTHERWISE == type)
    {
      found = true;

      // xsl:otherwise
      transformer.executeChildTemplates(childElem, true);

      return;
    }
  }

  if (!found)
    transformer.getMsgMgr().error(
      this, XSLTErrorResources.ER_CHOOSE_REQUIRES_WHEN);
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:55,代码来源:ElemChoose.java

示例12: execute

import org.apache.xalan.transformer.TransformerImpl; //导入方法依赖的package包/类
/**
 * The xsl:copy element provides an easy way of copying the current node.
 * Executing this function creates a copy of the current node into the
 * result tree.
 * <p>The namespace nodes of the current node are automatically
 * copied as well, but the attributes and children of the node are not
 * automatically copied. The content of the xsl:copy element is a
 * template for the attributes and children of the created node;
 * the content is instantiated only for nodes of types that can have
 * attributes or children (i.e. root nodes and element nodes).</p>
 * <p>The root node is treated specially because the root node of the
 * result tree is created implicitly. When the current node is the
 * root node, xsl:copy will not create a root node, but will just use
 * the content template.</p>
 *
 * @param transformer non-null reference to the the current transform-time state.
 *
 * @throws TransformerException
 */
public void execute(
        TransformerImpl transformer)
          throws TransformerException
{
              XPathContext xctxt = transformer.getXPathContext();
    
  try
  {
    int sourceNode = xctxt.getCurrentNode();
    xctxt.pushCurrentNode(sourceNode);
    DTM dtm = xctxt.getDTM(sourceNode);
    short nodeType = dtm.getNodeType(sourceNode);

    if ((DTM.DOCUMENT_NODE != nodeType) && (DTM.DOCUMENT_FRAGMENT_NODE != nodeType))
    {
      SerializationHandler rthandler = transformer.getSerializationHandler();

      // TODO: Process the use-attribute-sets stuff
      ClonerToResultTree.cloneToResultTree(sourceNode, nodeType, dtm, 
                                           rthandler, false);

      if (DTM.ELEMENT_NODE == nodeType)
      {
        super.execute(transformer);
        SerializerUtils.processNSDecls(rthandler, sourceNode, nodeType, dtm);
        transformer.executeChildTemplates(this, true);
        
        String ns = dtm.getNamespaceURI(sourceNode);
        String localName = dtm.getLocalName(sourceNode);
        transformer.getResultTreeHandler().endElement(ns, localName,
                                                      dtm.getNodeName(sourceNode));
      }
    }
    else
    {
      super.execute(transformer);
      transformer.executeChildTemplates(this, true);
    }
  }
  catch(org.xml.sax.SAXException se)
  {
    throw new TransformerException(se);
  }
  finally
  {
    xctxt.popCurrentNode();
  }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:68,代码来源:ElemCopy.java

示例13: constructNode

import org.apache.xalan.transformer.TransformerImpl; //导入方法依赖的package包/类
/**
 * Construct a node in the result tree.  This method is overloaded by 
 * xsl:attribute. At this class level, this method creates an element.
 * If the node is null, we instantiate only the content of the node in accordance
 * with section 7.1.2 of the XSLT 1.0 Recommendation.
 *
 * @param nodeName The name of the node, which may be <code>null</code>.  If <code>null</code>,
 *                 only the non-attribute children of this node will be processed.
 * @param prefix The prefix for the namespace, which may be <code>null</code>.
 *               If not <code>null</code>, this prefix will be mapped and unmapped.
 * @param nodeNamespace The namespace of the node, which may be not be <code>null</code>.
 * @param transformer non-null reference to the the current transform-time state.
 *
 * @throws TransformerException
 */
void constructNode(
        String nodeName, String prefix, String nodeNamespace, TransformerImpl transformer)
          throws TransformerException
{

  boolean shouldAddAttrs;

  try
  {
    SerializationHandler rhandler = transformer.getResultTreeHandler();

    if (null == nodeName)
    {
      shouldAddAttrs = false;
    }
    else
    {
      if (null != prefix)
      {
        rhandler.startPrefixMapping(prefix, nodeNamespace, true);
      }

      rhandler.startElement(nodeNamespace, QName.getLocalPart(nodeName),
                            nodeName);

      super.execute(transformer);

      shouldAddAttrs = true;
    }

    transformer.executeChildTemplates(this, shouldAddAttrs);

    // Now end the element if name was valid
    if (null != nodeName)
    {
      rhandler.endElement(nodeNamespace, QName.getLocalPart(nodeName),
                          nodeName);
      if (null != prefix)
      {
        rhandler.endPrefixMapping(prefix);
      }
    }
  }
  catch (SAXException se)
  {
    throw new TransformerException(se);
  }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:64,代码来源:ElemElement.java

示例14: execute

import org.apache.xalan.transformer.TransformerImpl; //导入方法依赖的package包/类
public void execute(TransformerImpl transformer, XObject[] args)
        throws TransformerException
{
  XPathContext xctxt = transformer.getXPathContext();
  VariableStack vars = xctxt.getVarStack();
  
  // Increment the frame bottom of the variable stack by the
  // frame size
  int thisFrame = vars.getStackFrame();
  int nextFrame = vars.link(m_frameSize);

  if (m_inArgsSize < args.length) {
    throw new TransformerException ("function called with too many args");
  }
  
  // Set parameters,
  // have to clear the section of the stack frame that has params.
  if (m_inArgsSize > 0) {
    vars.clearLocalSlots(0, m_inArgsSize);

    if (args.length > 0) {
      vars.setStackFrame(thisFrame);
      NodeList children = this.getChildNodes();
      
      for (int i = 0; i < args.length; i ++) {
        Node child = children.item(i);
        if (children.item(i) instanceof ElemParam) {
          ElemParam param = (ElemParam)children.item(i);
          vars.setLocalVariable(param.getIndex(), args[i], nextFrame);
        }
      }
      
      vars.setStackFrame(nextFrame);
    }
  }

  //  Removed ElemTemplate 'push' and 'pop' of RTFContext, in order to avoid losing the RTF context 
  //  before a value can be returned. ElemExsltFunction operates in the scope of the template that called 
  //  the function.
  //  xctxt.pushRTFContext();
  
  vars.setStackFrame(nextFrame);
  transformer.executeChildTemplates(this, true);
  
  // Reset the stack frame after the function call
  vars.unlink(thisFrame);

  // Following ElemTemplate 'pop' removed -- see above.
  // xctxt.popRTFContext(); 
  
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:52,代码来源:ElemExsltFunction.java


注:本文中的org.apache.xalan.transformer.TransformerImpl.executeChildTemplates方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。