Debian Codegraph @

net/sf/saxon/style/AbsentExtensionElement.java

raw symbols SCIP
1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2018 Saxonica Limited.
3 // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4 // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7
8 package net.sf.saxon.style;
9
10 import net.sf.saxon.expr.Expression;
11 import net.sf.saxon.trans.XPathException;
12
13 /**
14 * This element is a surrogate for an extension element (or indeed an xsl element)
15 * for which no implementation is available.
16 */
17
18 public class AbsentExtensionElement extends StyleElement {
19
20 public boolean isInstruction() {
21 return true;
22 }
23
24 /**
25 * Determine whether this type of element is allowed to contain a template-body
26 */
27
28 public boolean mayContainSequenceConstructor() {
29 return true;
30 }
31
32 /**
33 * Process the attributes of this element and all its children
34 */
35
36 public void processAllAttributes() throws XPathException {
37 if (reportingCircumstances == IGNORED_INSTRUCTION) {
38 return;
39 }
40 if (reportingCircumstances == REPORT_ALWAYS) {
41 throw validationError;
42 }
43 if (isTopLevel() && forwardsCompatibleModeIsEnabled()) {
44 // do nothing
45 } else {
46 super.processAllAttributes();
47 }
48 }
49
50 public void prepareAttributes() throws XPathException {
51 }
52
53 /**
54 * Recursive walk through the stylesheet to validate all nodes
55 *
56 * @param decl
57 * @param excludeStylesheet
58 */
59
60 public void validateSubtree(ComponentDeclaration decl, boolean excludeStylesheet) throws XPathException {
61 if (reportingCircumstances == IGNORED_INSTRUCTION || (isTopLevel() && forwardsCompatibleModeIsEnabled())) {
62 // do nothing
63 } else {
64 super.validateSubtree(decl, excludeStylesheet);
65 }
66 }
67
68 public void validate(ComponentDeclaration decl) throws XPathException {
69 }
70
71 /*@Nullable*/
72 public Expression compile(Compilation exec, ComponentDeclaration decl) throws XPathException {
73
74 if (isTopLevel() || reportingCircumstances == IGNORED_INSTRUCTION) {
75 return null;
76 }
77
78 // if there are fallback children, compile the code for the fallback elements
79
80 if (validationError == null) {
81 validationError = new XPathException("Unknown instruction");
82 }
83 return fallbackProcessing(exec, decl, this);
84 }
85 }
86