KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > saxon > style > AbsentExtensionElement


1 package net.sf.saxon.style;
2 import net.sf.saxon.expr.Expression;
3 import net.sf.saxon.instruct.Executable;
4 import net.sf.saxon.trans.StaticError;
5 import net.sf.saxon.trans.XPathException;
6
7 /**
8 * This element is a surrogate for an extension element (or indeed an xsl element)
9 * for which no implementation is available.
10 */

11
12 public class AbsentExtensionElement extends StyleElement {
13
14     public boolean isInstruction() {
15         return true;
16     }
17
18     /**
19     * Determine whether this type of element is allowed to contain a template-body
20     */

21
22     public boolean mayContainSequenceConstructor() {
23         return true;
24     }
25
26     /**
27      * Process the attributes of this element and all its children
28      */

29
30     public void processAllAttributes() throws XPathException {
31         if (isTopLevel() && forwardsCompatibleModeIsEnabled()) {
32             // do nothing
33
} else {
34             super.processAllAttributes();
35         }
36     }
37
38     public void prepareAttributes() throws XPathException {
39     }
40
41     /**
42      * Recursive walk through the stylesheet to validate all nodes
43      */

44
45     public void validateSubtree() throws XPathException {
46         if (isTopLevel() && forwardsCompatibleModeIsEnabled()) {
47             // do nothing
48
} else {
49             super.validateSubtree();
50         }
51     }
52
53     public void validate() throws XPathException {
54     }
55
56     public Expression compile(Executable exec) throws XPathException {
57
58         if (isTopLevel()) {
59             return null;
60         }
61
62         // if there are fallback children, compile the code for the fallback elements
63

64         if (validationError==null) {
65             validationError = new StaticError("Unknown instruction");
66         }
67         return fallbackProcessing(exec, this);
68     }
69 }
70
71 //
72
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
73
// you may not use this file except in compliance with the License. You may obtain a copy of the
74
// License at http://www.mozilla.org/MPL/
75
//
76
// Software distributed under the License is distributed on an "AS IS" basis,
77
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
78
// See the License for the specific language governing rights and limitations under the License.
79
//
80
// The Original Code is: all this file.
81
//
82
// The Initial Developer of the Original Code is Michael H. Kay.
83
//
84
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
85
//
86
// Contributor(s):
87
// Portions marked "e.g." are from Edwin Glaser (edwin@pannenleiter.de)
88
//
89
Popular Tags