Debian Codegraph @

net/sf/saxon/style/XSLWherePopulated.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.expr.instruct.WherePopulated;
12 import net.sf.saxon.om.AttributeCollection;
13 import net.sf.saxon.trans.XPathException;
14
15
16 /**
17 * An xsl:where-populated element in the stylesheet.
18 */
19
20 public final class XSLWherePopulated extends StyleElement {
21
22 private Expression select;
23
24 /**
25 * Determine whether this node is an instruction.
26 *
27 * @return true - it is an instruction
28 */
29
30 public boolean isInstruction() {
31 return true;
32 }
33
34 /**
35 * Determine whether this type of element is allowed to contain a sequence constructor
36 *
37 * @return in XSLT 2.0, false. In XSLT 3.0 true: yes, it may contain a sequence constructor
38 */
39
40 public boolean mayContainSequenceConstructor() {
41 return true;
42 }
43
44 /**
45 * Determine whether this type of element is allowed to contain an xsl:fallback
46 * instruction
47 */
48
49 public boolean mayContainFallback() {
50 return true;
51 }
52
53 public void prepareAttributes() throws XPathException {
54
55 AttributeCollection atts = getAttributeList();
56
57 for (int a = 0; a < atts.getLength(); a++) {
58 checkUnknownAttribute(atts.getNodeName(a));
59 }
60 }
61
62 public void validate(ComponentDeclaration decl) throws XPathException {
63 // no action
64 }
65
66 /*@Nullable*/
67 public Expression compile(Compilation exec, ComponentDeclaration decl) throws XPathException {
68 if (select == null) {
69 select = compileSequenceConstructor(exec, decl, false);
70 }
71 return new WherePopulated(select);
72 }
73
74 }