KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > icl > saxon > style > XSLFallback


1 package com.icl.saxon.style;
2 import com.icl.saxon.tree.AttributeCollection;
3 import com.icl.saxon.*;
4 import com.icl.saxon.expr.*;
5 import javax.xml.transform.*;
6
7 import java.io.*;
8
9 /**
10 * xsl:fallback element in stylesheet.<BR>
11 */

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

21
22     public boolean isInstruction() {
23         return true;
24     }
25
26     /**
27     * Determine whether this element does any processing after instantiating any children.
28     * This implementation says it doesn't, thus enabling tail recursion.
29     */

30
31     public boolean doesPostProcessing() {
32         return false;
33     }
34
35     /**
36     * Determine whether this type of element is allowed to contain a template-body
37     * @return true: yes, it may contain a template-body
38     */

39
40     public boolean mayContainTemplateBody() {
41         return true;
42     }
43
44     public void prepareAttributes() throws TransformerConfigurationException {
45         AttributeCollection atts = getAttributeList();
46         for (int a=0; a<atts.getLength(); a++) {
47             int nc = atts.getNameCode(a);
48             checkUnknownAttribute(nc);
49         }
50     }
51
52     public void validate() throws TransformerConfigurationException {
53         checkWithinTemplate();
54     }
55
56     public void process(Context context) throws TransformerException {
57         if (((StyleElement)getParentNode()).validationError!=null) {
58             processChildren(context);
59         }
60     }
61 }
62
63 //
64
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
65
// you may not use this file except in compliance with the License. You may obtain a copy of the
66
// License at http://www.mozilla.org/MPL/
67
//
68
// Software distributed under the License is distributed on an "AS IS" basis,
69
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
70
// See the License for the specific language governing rights and limitations under the License.
71
//
72
// The Original Code is: all this file.
73
//
74
// The Initial Developer of the Original Code is
75
// Michael Kay of International Computers Limited (mhkay@iclway.co.uk).
76
//
77
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
78
//
79
// Contributor(s): none.
80
//
81
Popular Tags