/** * Get the ExpressionNode parent of this node. */ public ExpressionNode exprGetParent() { return getParentElem(); }
/** * Get the ExpressionNode parent of this node. */ public ExpressionNode exprGetParent() { return getParentElem(); }
/** * Count the number of ancestors that a ElemTemplateElement has. * * @param elem An representation of an element in an XSLT stylesheet. * @return The number of ancestors of elem (including the element itself). */ protected int countAncestors(ElemTemplateElement elem) { int count = 0; while(null != elem) { count++; elem = elem.getParentElem(); } return count; }
/** * Determine whether the func:result element is within a func:function element. * If not, it is illegal. */ private boolean ancestorIsFunction(ElemTemplateElement child) { while (child.getParentElem() != null && !(child.getParentElem() instanceof StylesheetRoot)) { if (child.getParentElem() instanceof ElemExsltFunction) return true; child = child.getParentElem(); } return false; }
/** * Verify that a literal result belongs to a result element, a variable, * or a parameter. */ boolean ancestorIsOk(ElemTemplateElement child) { while (child.getParentElem() != null && !(child.getParentElem() instanceof ElemExsltFunction)) { ElemTemplateElement parent = child.getParentElem(); if (parent instanceof ElemExsltFuncResult || parent instanceof ElemVariable || parent instanceof ElemParam || parent instanceof ElemMessage) return true; child = parent; } return false; }
/** * Count the number of ancestors that a ElemTemplateElement has. * * @param elem An representation of an element in an XSLT stylesheet. * @return The number of ancestors of elem (including the element itself). */ protected int countAncestors(ElemTemplateElement elem) { int count = 0; while(null != elem) { count++; elem = elem.getParentElem(); } return count; }
/** * Verify that a literal result belongs to a result element, a variable, * or a parameter. */ boolean ancestorIsOk(ElemTemplateElement child) { while (child.getParentElem() != null && !(child.getParentElem() instanceof ElemExsltFunction)) { ElemTemplateElement parent = child.getParentElem(); if (parent instanceof ElemExsltFuncResult || parent instanceof ElemVariable || parent instanceof ElemParam || parent instanceof ElemMessage) return true; child = parent; } return false; }
/** * Get whether or not the passed URL is contained flagged by * the "extension-element-prefixes" property. This method is overridden * by {@link ElemLiteralResult#containsExcludeResultPrefix}. * @see <a href="http://www.w3.org/TR/xslt#extension-element">extension-element in XSLT Specification</a> * * @param prefix non-null reference to prefix that might be excluded. * * @return true if the prefix should normally be excluded. */ public boolean containsExcludeResultPrefix(String prefix, String uri) { ElemTemplateElement parent = this.getParentElem(); if(null != parent) return parent.containsExcludeResultPrefix(prefix, uri); return false; }
/** * Get whether or not the passed URL is contained flagged by * the "extension-element-prefixes" property. This method is overridden * by {@link ElemLiteralResult#containsExcludeResultPrefix}. * @see <a href="http://www.w3.org/TR/xslt#extension-element">extension-element in XSLT Specification</a> * * @param prefix non-null reference to prefix that might be excluded. * * @return true if the prefix should normally be excluded. */ public boolean containsExcludeResultPrefix(String prefix, String uri) { ElemTemplateElement parent = this.getParentElem(); if(null != parent) return parent.containsExcludeResultPrefix(prefix, uri); return false; }
if (oldChildElem == null || oldChildElem.getParentElem() != this) return null;
private double getElemVersion() { ElemTemplateElement elem = getElemTemplateElement(); double version = -1; while ((version == -1 || version == Constants.XSLTVERSUPPORTED) && elem != null) { try{ version = Double.valueOf(elem.getXmlVersion()).doubleValue(); } catch (Exception ex) { version = -1; } elem = elem.getParentElem(); } return (version == -1)? Constants.XSLTVERSUPPORTED : version; } /**
private double getElemVersion() { ElemTemplateElement elem = getElemTemplateElement(); double version = -1; while ((version == -1 || version == Constants.XSLTVERSUPPORTED) && elem != null) { try{ version = Double.valueOf(elem.getXmlVersion()).doubleValue(); } catch (Exception ex) { version = -1; } elem = elem.getParentElem(); } return (version == -1)? Constants.XSLTVERSUPPORTED : version; } /**
/** * Get the owning xsl:template element. * * @return The owning xsl:template element, this element if it is a xsl:template, or null if not found. */ public ElemTemplate getOwnerXSLTemplate() { ElemTemplateElement el = this; int type = el.getXSLToken(); while((null != el) && (type != Constants.ELEMNAME_TEMPLATE)) { el = el.getParentElem(); if(null != el) type = el.getXSLToken(); } return (ElemTemplate)el; }
/** * Get the owning xsl:template element. * * @return The owning xsl:template element, this element if it is a xsl:template, or null if not found. */ public ElemTemplate getOwnerXSLTemplate() { ElemTemplateElement el = this; int type = el.getXSLToken(); while((null != el) && (type != Constants.ELEMNAME_TEMPLATE)) { el = el.getParentElem(); if(null != el) type = el.getXSLToken(); } return (ElemTemplate)el; }
/** * This method retrieves the xsl:template * that is in effect, which may be a matched template * or a named template. * * <p>Please note that the ElemTemplate returned may * be a default template, and thus may not have a template * defined in the stylesheet.</p> * * @return The current xsl:template, should not be null. */ public ElemTemplate getCurrentTemplate() { ElemTemplateElement elem = getCurrentElement(); while ((null != elem) && (elem.getXSLToken() != Constants.ELEMNAME_TEMPLATE)) { elem = elem.getParentElem(); } return (ElemTemplate) elem; }
ElemTemplateElement ancestor = handler.getElemTemplateElement().getParentElem(); while (ancestor != null && !(ancestor instanceof ElemExsltFunction)) handler.error(msg, new SAXException(msg)); ancestor = ancestor.getParentElem();
/** * This method retrieves the xsl:template * that is in effect, which may be a matched template * or a named template. * * <p>Please note that the ElemTemplate returned may * be a default template, and thus may not have a template * defined in the stylesheet.</p> * * @return The current xsl:template, should not be null. */ public ElemTemplate getCurrentTemplate() { ElemTemplateElement elem = getCurrentElement(); while ((null != elem) && (elem.getXSLToken() != Constants.ELEMNAME_TEMPLATE)) { elem = elem.getParentElem(); } return (ElemTemplate) elem; }
/** * Get the previous sibling or parent of the given template, stopping at * xsl:for-each, xsl:template, or xsl:stylesheet. * * @param elem Should be non-null template element. * @return previous sibling or parent, or null if previous is xsl:for-each, * xsl:template, or xsl:stylesheet. */ protected ElemTemplateElement getPrevElementWithinContext(ElemTemplateElement elem) { ElemTemplateElement prev = elem.getPreviousSiblingElem(); if(null == prev) prev = elem.getParentElem(); if(null != prev) { int type = prev.getXSLToken(); if((Constants.ELEMNAME_FOREACH == type) || (Constants.ELEMNAME_TEMPLATE == type) || (Constants.ELEMNAME_STYLESHEET == type)) { prev = null; } } return prev; }
/** * Get the previous sibling or parent of the given template, stopping at * xsl:for-each, xsl:template, or xsl:stylesheet. * * @param elem Should be non-null template element. * @return previous sibling or parent, or null if previous is xsl:for-each, * xsl:template, or xsl:stylesheet. */ protected ElemTemplateElement getPrevElementWithinContext(ElemTemplateElement elem) { ElemTemplateElement prev = elem.getPreviousSiblingElem(); if(null == prev) prev = elem.getParentElem(); if(null != prev) { int type = prev.getXSLToken(); if((Constants.ELEMNAME_FOREACH == type) || (Constants.ELEMNAME_TEMPLATE == type) || (Constants.ELEMNAME_STYLESHEET == type)) { prev = null; } } return prev; }
return false; ete = ete.getParentElem();