Debian Codegraph @

net/sf/saxon/style/XSLFallback.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.om.AttributeCollection;
12 import net.sf.saxon.trans.XPathException;
13
14 /**
15 * xsl:fallback element in stylesheet. <br>
16 */
17
18 public class XSLFallback extends StyleElement {
19
20 /**
21 * Determine whether this node is an instruction.
22 *
23 * @return true - it is an instruction
24 */
25
26 public boolean isInstruction() {
27 return true;
28 }
29
30 /**
31 * Determine whether this type of element is allowed to contain a template-body
32 *
33 * @return true: yes, it may contain a template-body
34 */
35
36 public boolean mayContainSequenceConstructor() {
37 return true;
38 }
39
40 /**
41 * Ask whether variables declared in an "uncle" element are visible.
42 *
43 * @return true for all elements except xsl:fallback and saxon:catch
44 */
45
46 protected boolean seesAvuncularVariables() {
47 return false;
48 }
49
50 public void prepareAttributes() throws XPathException {
51 AttributeCollection atts = getAttributeList();
52 for (int a = 0; a < atts.getLength(); a++) {
53 checkUnknownAttribute(atts.getNodeName(a));
54 }
55 }
56
57 public void validate(ComponentDeclaration decl) throws XPathException {
58 // Parent elements are now responsible for validating their children
59 // StyleElement parent = (StyleElement)getParent();
60 // if (!parent.mayContainFallback()) {
61 // compileError("xsl:fallback is not allowed as a child of " + parent.getDisplayName(), "XT0010");
62 // }
63 }
64
65 /*@Nullable*/
66 public Expression compile(Compilation exec, ComponentDeclaration decl) throws XPathException {
67 // if we get here, then the parent instruction is OK, so the fallback is not activated
68 return null;
69 }
70
71 }
72