KickJava   Java API By Example, From Geeks To Geeks.

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


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.om.AttributeCollection;
5 import net.sf.saxon.trans.XPathException;
6
7 import javax.xml.transform.TransformerConfigurationException JavaDoc;
8
9 /**
10 * xsl:fallback element in stylesheet. <br>
11 */

12
13 public class XSLFallback extends StyleElement {
14
15     /**
16     * Determine whether this node is an instruction.
17     * @return true - it is an instruction
18     */

19
20     public boolean isInstruction() {
21         return true;
22     }
23
24     /**
25     * Determine whether this type of element is allowed to contain a template-body
26     * @return true: yes, it may contain a template-body
27     */

28
29     public boolean mayContainSequenceConstructor() {
30         return true;
31     }
32
33     public void prepareAttributes() throws XPathException {
34         AttributeCollection atts = getAttributeList();
35         for (int a=0; a<atts.getLength(); a++) {
36             int nc = atts.getNameCode(a);
37             checkUnknownAttribute(nc);
38         }
39     }
40
41     public void validate() throws XPathException {
42         // Parent elements are now responsible for validating their children
43
// StyleElement parent = (StyleElement)getParent();
44
// if (!parent.mayContainFallback()) {
45
// compileError("xsl:fallback is not allowed as a child of " + parent.getDisplayName(), "XT0010");
46
// }
47
}
48
49     public Expression compile(Executable exec) throws XPathException {
50         // if we get here, then the parent instruction is OK, so the fallback is not activated
51
return null;
52     }
53
54 }
55
56 //
57
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
58
// you may not use this file except in compliance with the License. You may obtain a copy of the
59
// License at http://www.mozilla.org/MPL/
60
//
61
// Software distributed under the License is distributed on an "AS IS" basis,
62
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
63
// See the License for the specific language governing rights and limitations under the License.
64
//
65
// The Original Code is: all this file.
66
//
67
// The Initial Developer of the Original Code is Michael H. Kay.
68
//
69
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
70
//
71
// Contributor(s): none.
72
//
73
Popular Tags