01: package net.sf.saxon.style;
02:
03: import net.sf.saxon.expr.Expression;
04: import net.sf.saxon.instruct.Executable;
05: import net.sf.saxon.om.AttributeCollection;
06: import net.sf.saxon.trans.XPathException;
07:
08: /**
09: * xsl:fallback element in stylesheet. <br>
10: */
11:
12: public class XSLFallback extends StyleElement {
13:
14: /**
15: * Determine whether this node is an instruction.
16: * @return true - it is an instruction
17: */
18:
19: public boolean isInstruction() {
20: return true;
21: }
22:
23: /**
24: * Determine whether this type of element is allowed to contain a template-body
25: * @return true: yes, it may contain a template-body
26: */
27:
28: public boolean mayContainSequenceConstructor() {
29: return true;
30: }
31:
32: public void prepareAttributes() throws XPathException {
33: AttributeCollection atts = getAttributeList();
34: for (int a = 0; a < atts.getLength(); a++) {
35: int nc = atts.getNameCode(a);
36: checkUnknownAttribute(nc);
37: }
38: }
39:
40: public void validate() throws XPathException {
41: // Parent elements are now responsible for validating their children
42: // StyleElement parent = (StyleElement)getParent();
43: // if (!parent.mayContainFallback()) {
44: // compileError("xsl:fallback is not allowed as a child of " + parent.getDisplayName(), "XT0010");
45: // }
46: }
47:
48: public Expression compile(Executable exec) throws XPathException {
49: // if we get here, then the parent instruction is OK, so the fallback is not activated
50: return null;
51: }
52:
53: }
54:
55: //
56: // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
57: // you may not use this file except in compliance with the License. You may obtain a copy of the
58: // License at http://www.mozilla.org/MPL/
59: //
60: // Software distributed under the License is distributed on an "AS IS" basis,
61: // WITHOUT WARRANTY OF ANY KIND, either express or implied.
62: // See the License for the specific language governing rights and limitations under the License.
63: //
64: // The Original Code is: all this file.
65: //
66: // The Initial Developer of the Original Code is Michael H. Kay.
67: //
68: // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
69: //
70: // Contributor(s): none.
71: //
|