List of usage examples for org.dom4j.rule Stylesheet applyTemplates
public void applyTemplates(List<? extends Node> list, String mode) throws Exception
From source file:org.apache.taglibs.xtags.xpath.ApplyTemplatesTag.java
License:Apache License
public int doEndTag() throws JspException { flush();//from w ww .j av a 2 s .co m Stylesheet stylesheet = getStylesheet(); if (stylesheet == null) { throw new JspException("applytemplates tag requires a Stylesheet to be in scope"); } else { try { // Tell the current TemplateTag to put its output in the Stylesheet's output list, // otherwise the order of the output will be incorrect. TemplateTag templateTag = (TemplateTag) findAncestorWithClass(this, TemplateTag.class); templateTag.preApplyTemplates(); Object context = getInputNodes(); if (xpath != null) { stylesheet.applyTemplates(context, xpath); } else { stylesheet.applyTemplates(context); } // restore the context back to what it was setInputNodes(context); } catch (JspException e) { throw e; } catch (Exception e) { handleException(e); } } return EVAL_PAGE; }