KickJava   Java API By Example, From Geeks To Geeks.

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


1 package com.icl.saxon.style;
2 import com.icl.saxon.tree.AttributeCollection;
3 import com.icl.saxon.*;
4 import javax.xml.transform.*;
5
6
7
8 /**
9 * Handler for xsl:otherwise elements in stylesheet.<BR>
10 */

11
12 public class XSLOtherwise extends StyleElement {
13
14     public void prepareAttributes() throws TransformerConfigurationException {
15         AttributeCollection atts = getAttributeList();
16         for (int a=0; a<atts.getLength(); a++) {
17             int nc = atts.getNameCode(a);
18             checkUnknownAttribute(nc);
19         }
20     }
21
22     /**
23     * Determine whether this element does any processing after instantiating any children.
24     * This implementation says it doesn't, thus enabling tail recursion.
25     */

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

35
36     public boolean mayContainTemplateBody() {
37         return true;
38     }
39
40     public void validate() throws TransformerConfigurationException {
41         if (!(getParentNode() instanceof XSLChoose)) {
42             compileError("xsl:otherwise must be immediately within xsl:choose");
43         }
44     }
45
46     public void process(Context context) throws TransformerException
47     {
48         processChildren(context); // the condition is tested from the outer xsl:choose element
49
}
50
51 }
52
53 //
54
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
55
// you may not use this file except in compliance with the License. You may obtain a copy of the
56
// License at http://www.mozilla.org/MPL/
57
//
58
// Software distributed under the License is distributed on an "AS IS" basis,
59
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
60
// See the License for the specific language governing rights and limitations under the License.
61
//
62
// The Original Code is: all this file.
63
//
64
// The Initial Developer of the Original Code is
65
// Michael Kay of International Computers Limited (mhkay@iclway.co.uk).
66
//
67
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
68
//
69
// Contributor(s): none.
70
//
71
Popular Tags