/** * Call the compose function for each ElemTemplateElement. * * @param templ non-null reference to template element that will have * the composed method called on it, and will have it's children's composed * methods called. */ void composeTemplates(ElemTemplateElement templ) throws TransformerException { templ.compose(this); for (ElemTemplateElement child = templ.getFirstChildElem(); child != null; child = child.getNextSiblingElem()) { composeTemplates(child); } templ.endCompose(this); }
/** * @see XSLTVisitable#callVisitors(XSLTVisitor) */ public void callVisitors(XSLTVisitor visitor) { if(accept(visitor)) { callChildVisitors(visitor); } }
setPrefixTable(null); StylesheetRoot stylesheet = this.getStylesheetRoot(); if(null == uri) uri = ""; boolean shouldExclude = excludeResultNSDecl(prefix, uri); setPrefixTable(new ArrayList()); ElemTemplateElement parent = this.getParentNodeElem(); if (null == m_prefixTable && !needToCheckExclude()) setPrefixTable(parent.m_prefixTable); boolean shouldExclude = excludeResultNSDecl(decl.getPrefix(), decl.getURI()); addOrReplaceDecls(decl); setPrefixTable(new ArrayList());
/** * 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; }
for(int j = 0; j < numStepCorrection; j++) elems[i] = elems[i].getParentElem(); if(areEqual && isNotSameAsOwner(head, first) && first.canAcceptVariables()) System.err.println(" at " + first.getSystemId() + " Line " + first.getLineNumber()); elems[i] = elems[i].getParentElem();
/** * Add a child to the child list. * * @param newChild Child to add to children list * * @return Child added to children list * * @throws DOMException */ public ElemTemplateElement appendChild(ElemTemplateElement newChild) { int type = ((ElemTemplateElement) newChild).getXSLToken(); switch (type) { case Constants.ELEMNAME_TEXTLITERALRESULT : break; default : error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]{ newChild.getNodeName(), this.getNodeName() }); //"Can not add " +((ElemTemplateElement)newChild).m_elemName + //" to " + this.m_elemName); } return super.appendChild(newChild); } }
/** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); }
/** * Call the children visitors. * @param visitor The visitor whose appropriate method will be called. */ protected void callChildVisitors(XSLTVisitor visitor, boolean callAttributes) { for (ElemTemplateElement node = m_firstChild; node != null; node = node.m_nextSibling) { node.callVisitors(visitor); } }
/** * This after the template's children have been composed. */ public void endCompose(StylesheetRoot sroot) throws TransformerException { StylesheetRoot.ComposeState cstate = sroot.getComposeState(); super.endCompose(sroot); m_frameSize = cstate.getFrameSize(); cstate.resetStackFrameSize(); }
/** * Call the children visitors. * @param visitor The visitor whose appropriate method will be called. */ protected void callChildVisitors(XSLTVisitor visitor) { callChildVisitors(visitor, true); }
/** * Tell if the result namespace decl should be excluded. Should be called before * namespace aliasing (I think). * * @param prefix non-null reference to prefix. * @param uri reference to namespace that prefix maps to, which is protected * for null, but should really never be passed as null. * * @return true if the given namespace should be excluded. * * @throws TransformerException */ private boolean excludeResultNSDecl(String prefix, String uri) throws TransformerException { if (uri != null) { if (uri.equals(Constants.S_XSLNAMESPACEURL) || getStylesheet().containsExtensionElementURI(uri)) return true; if (containsExcludeResultPrefix(prefix, uri)) return true; } return false; }
/** * Add a child to the child list. * <!ELEMENT xsl:apply-templates (xsl:sort|xsl:with-param)*> * <!ATTLIST xsl:apply-templates * select %expr; "node()" * mode %qname; #IMPLIED * > * * @param newChild Child to add to child list * * @return Child just added to child list */ public ElemTemplateElement appendChild(ElemTemplateElement newChild) { int type = ((ElemTemplateElement) newChild).getXSLToken(); if (Constants.ELEMNAME_SORT == type) { setSortElem((ElemSort) newChild); return newChild; } else return super.appendChild(newChild); }
/** * This method tells the node to add its argument to the node's * list of children. * @param n Must be a ElemTemplateElement. */ public void exprAddChild(ExpressionNode n, int i) { appendChild((ElemTemplateElement)n); }
/** * Append the current template element to the current * template element, and then push it onto the current template * element stack. * * @param handler non-null reference to current StylesheetHandler that is constructing the Templates. * @param elem non-null reference to a {@link org.apache.xalan.templates.ElemText}. * * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. */ protected void appendAndPush( StylesheetHandler handler, ElemTemplateElement elem) throws org.xml.sax.SAXException { // Don't push this element onto the element stack. ProcessorCharacters charProcessor = (ProcessorCharacters) handler.getProcessorFor(null, "text()", "text"); charProcessor.setXslTextElement((ElemText) elem); ElemTemplateElement parent = handler.getElemTemplateElement(); parent.appendChild(elem); elem.setDOMBackPointer(handler.getOriginatingNode()); }
for(int j = 0; j < numStepCorrection; j++) elems[i] = elems[i].getParentElem(); if(areEqual && isNotSameAsOwner(head, first) && first.canAcceptVariables()) System.err.println(" at " + first.getSystemId() + " Line " + first.getLineNumber()); elems[i] = elems[i].getParentElem();
/** * 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; }
/** * This function is called after everything else has been * recomposed, and allows the template to set remaining * values that may be based on some other property that * depends on recomposition. */ public void compose(StylesheetRoot sroot) throws TransformerException { super.compose(sroot); }
/** * Call the children visitors. * @param visitor The visitor whose appropriate method will be called. */ protected void callChildVisitors(XSLTVisitor visitor, boolean callAttributes) { for (ElemTemplateElement node = m_firstChild; node != null; node = node.m_nextSibling) { node.callVisitors(visitor); } }