/** * Ask whether this is an instruction that is known to be constructing nodes which * will become children of a parent document or element node, and will not have an * independent existence of their own. * * @return true if it is known that this is an instruction that creates nodes that * will immediately be attached to a parent element or document node */ public boolean isConstructingComplexContent() { if (!isInstruction()) { return false; } NodeInfo parent = getParent(); while (true) { if (!(parent instanceof StyleElement && ((StyleElement) parent).isInstruction())) { return false; } if (parent instanceof XSLGeneralVariable) { return ((XSLGeneralVariable) parent).getAttributeValue("as") == null; } if (parent instanceof XSLElement || parent instanceof LiteralResultElement || parent instanceof XSLDocument || parent instanceof XSLCopy) { return true; } parent = parent.getParent(); } }
/** * Method to support the element-available() function * * * @param uri the namespace URI * @param localName the local Name * @param instructionsOnly true if only instruction elements qualify * @return true if an extension element of this name is recognized */ public boolean isElementAvailable(String uri, String localName, boolean instructionsOnly) { int fingerprint = namePool.getFingerprint(uri, localName); if (uri.equals(NamespaceConstant.XSLT)) { if (fingerprint == -1) { return false; // all names are pre-registered } StyleElement e = makeXSLElement(fingerprint, null); if (e != null) { return !instructionsOnly || e.isInstruction(); } } return false; }
/** * Ask whether this is an instruction that is known to be constructing nodes which * will become children of a parent document or element node, and will not have an * independent existence of their own. * @return true if it is known that this is an instruction that creates nodes that * will immediately be attached to a parent element or document node */ public boolean isConstructingComplexContent() { if (!isInstruction()) { return false; } NodeInfo parent = getParent(); while (true) { if (!(parent instanceof StyleElement && ((StyleElement)parent).isInstruction())) { return false; } if (parent instanceof XSLGeneralVariable) { return ((XSLGeneralVariable)parent).getAttributeValue("as") == null; } if (parent instanceof XSLElement || parent instanceof LiteralResultElement || parent instanceof XSLDocument || parent instanceof XSLCopy) { return true; } parent = parent.getParent(); } }
/** * Method to support the element-available() function * * * @param uri the namespace URI * @param localName the local Name * @param instructionsOnly true if only instruction elements qualify * @return true if an extension element of this name is recognized */ public boolean isElementAvailable(String uri, String localName, boolean instructionsOnly) { int fingerprint = namePool.getFingerprint(uri, localName); if (uri.equals(NamespaceConstant.XSLT)) { if (fingerprint == -1) { return false; // all names are pre-registered } StyleElement e = makeXSLElement(fingerprint, null); if (e != null) { return !instructionsOnly || e.isInstruction(); } } return false; }
/** * Method to support the element-available() function * @param uri the namespace URI * @param localName the local Name * @return true if an extension element of this name is recognized */ public boolean isElementAvailable(String uri, String localName) { int fingerprint = namePool.getFingerprint(uri, localName); if (uri.equals(NamespaceConstant.XSLT)) { if (fingerprint==-1) return false; // all names are pre-registered StyleElement e = makeXSLElement(fingerprint); if (e!=null) return e.isInstruction(); } if (uri.equals(NamespaceConstant.SAXON)) { if (fingerprint==-1) return false; // all names are pre-registered StyleElement e = makeSaxonElement(fingerprint); if (e!=null) return e.isInstruction(); } if (!allowExtensions) { // extension elements are disabled return false; } short uriCode = namePool.getCodeForURI(uri); ExtensionElementFactory factory = getFactory(uriCode); if (factory==null) return false; Class actualClass = factory.getExtensionClass(localName); return (actualClass != null); }
if (isInstruction() && clarkName.startsWith('{' + NamespaceConstant.XSLT) && !(elementURI.equals(NamespaceConstant.XSLT)) &&
/** * Method to support the element-available() function * @param uri the namespace URI * @param localName the local Name * @return true if an extension element of this name is recognized */ public boolean isElementAvailable(String uri, String localName) { int fingerprint = namePool.getFingerprint(uri, localName); if (uri.equals(NamespaceConstant.XSLT)) { if (fingerprint==-1) return false; // all names are pre-registered StyleElement e = makeXSLElement(fingerprint); if (e!=null) return e.isInstruction(); } if (uri.equals(NamespaceConstant.SAXON)) { if (fingerprint==-1) return false; // all names are pre-registered StyleElement e = makeSaxonElement(fingerprint); if (e!=null) return e.isInstruction(); } if (!allowExtensions) { // extension elements are disabled return false; } short uriCode = namePool.getCodeForURI(uri); ExtensionElementFactory factory = getFactory(uriCode); if (factory==null) return false; Class actualClass = factory.getExtensionClass(localName); return (actualClass != null); }
/** * Method to support the element-available() function * @param uri the namespace URI * @param localName the local Name * @return true if an extension element of this name is recognized */ public boolean isElementAvailable(String uri, String localName) { int fingerprint = namePool.getFingerprint(uri, localName); if (uri.equals(NamespaceConstant.XSLT)) { if (fingerprint==-1) return false; // all names are pre-registered StyleElement e = makeXSLElement(fingerprint); if (e!=null) return e.isInstruction(); } if (uri.equals(NamespaceConstant.SAXON)) { if (fingerprint==-1) return false; // all names are pre-registered StyleElement e = makeSaxonElement(fingerprint); if (e!=null) return e.isInstruction(); } if (!allowExtensions) { // extension elements are disabled return false; } short uriCode = namePool.getCodeForURI(uri); ExtensionElementFactory factory = getFactory(uriCode); if (factory==null) return false; Class actualClass = factory.getExtensionClass(localName); return (actualClass != null); }
if (isInstruction() && attributeURI.equals(NamespaceConstant.XSLT) && !elementURI.equals(NamespaceConstant.XSLT) &&
if (isInstruction() && clarkName.startsWith('{' + NamespaceConstant.XSLT) && !(elementURI.equals(NamespaceConstant.XSLT)) &&
if (isInstruction() && attributeURI.equals(NamespaceConstant.XSLT) && !elementURI.equals(NamespaceConstant.XSLT) &&
/** * Validate the children of this node, recursively. Overridden for top-level * data elements. */ protected void validateChildren() throws XPathException { boolean containsInstructions = mayContainSequenceConstructor(); AxisIterator kids = iterateAxis(Axis.CHILD); StyleElement lastChild = null; while (true) { NodeInfo child = (NodeInfo)kids.next(); if (child == null) { break; } if (child instanceof StyleElement) { if (containsInstructions && !((StyleElement)child).isInstruction() && !isPermittedChild((StyleElement)child)) { ((StyleElement)child).compileError("An " + getDisplayName() + " element must not contain an " + child.getDisplayName() + " element", "XTSE0010"); } ((StyleElement)child).validateSubtree(); lastChild = (StyleElement)child; } } if (lastChild instanceof XSLVariable && !(this instanceof XSLStylesheet)) { lastChild.compileWarning("A variable with no following sibling instructions has no effect", SaxonErrorCode.SXWN9001); } }
/** * Validate the children of this node, recursively. Overridden for top-level * data elements. */ protected void validateChildren() throws XPathException { boolean containsInstructions = mayContainSequenceConstructor(); AxisIterator kids = iterateAxis(Axis.CHILD); StyleElement lastChild = null; while (true) { NodeInfo child = (NodeInfo)kids.next(); if (child == null) { break; } if (child instanceof StyleElement) { if (containsInstructions && !((StyleElement)child).isInstruction() && !isPermittedChild((StyleElement)child)) { ((StyleElement)child).compileError("An " + getDisplayName() + " element must not contain an " + child.getDisplayName() + " element", "XTSE0010"); } ((StyleElement)child).validateSubtree(); lastChild = (StyleElement)child; } } if (lastChild instanceof XSLVariable && !(this instanceof XSLStylesheet)) { lastChild.compileWarning("A variable with no following sibling instructions has no effect", SaxonErrorCode.SXWN9001); } }
if (!(excludeStylesheet && child instanceof XSLStylesheet)) { endsWithTextTemplate = false; if (containsInstructions && !((StyleElement) child).isInstruction() && !isPermittedChild((StyleElement) child)) { ((StyleElement) child).compileError("An " + getDisplayName() + " element must not contain an " +
if (!(excludeStylesheet && child instanceof XSLStylesheet)) { endsWithTextTemplate = false; if (containsInstructions && !((StyleElement) child).isInstruction() && !isPermittedChild((StyleElement) child)) { ((StyleElement) child).compileError("An " + getDisplayName() + " element must not contain an " +