Debian Codegraph @

net/sf/saxon/style/XSLOtherwise.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 /**
16 * Handler for xsl:otherwise elements in stylesheet. <br>
17 */
18
19 public class XSLOtherwise extends StyleElement {
20
21
22 public void prepareAttributes() throws XPathException {
23 AttributeCollection atts = getAttributeList();
24 for (int a = 0; a < atts.getLength(); a++) {
25 checkUnknownAttribute(atts.getNodeName(a));
26 }
27 }
28
29 /**
30 * Determine whether this type of element is allowed to contain a template-body
31 *
32 * @return true: yes, it may contain a template-body
33 */
34
35 public boolean mayContainSequenceConstructor() {
36 return true;
37 }
38
39 public void validate(ComponentDeclaration decl) throws XPathException {
40 if (!(getParent() instanceof XSLChoose)) {
41 compileError("xsl:otherwise must be immediately within xsl:choose", "XTSE0010");
42 }
43 }
44
45 /**
46 * Mark tail-recursive calls on stylesheet functions. For most instructions, this does nothing.
47 */
48
49 public boolean markTailCalls() {
50 StyleElement last = getLastChildInstruction();
51 return last != null && last.markTailCalls();
52 }
53
54 /*@NotNull*/
55 public Expression compile(Compilation exec, ComponentDeclaration decl) throws XPathException {
56 throw new UnsupportedOperationException("XSLOtherwise#compile() should not be called");
57 }
58
59 }
60