KickJava   Java API By Example, From Geeks To Geeks.

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


1 package net.sf.saxon.style;
2 import net.sf.saxon.expr.Expression;
3 import net.sf.saxon.instruct.Doctype;
4 import net.sf.saxon.instruct.Executable;
5 import net.sf.saxon.om.Axis;
6 import net.sf.saxon.om.AttributeCollection;
7 import net.sf.saxon.value.EmptySequence;
8 import net.sf.saxon.trans.XPathException;
9
10 import javax.xml.transform.TransformerConfigurationException JavaDoc;
11
12 /**
13 * A saxon:doctype element in the stylesheet.
14 */

15
16 public class SaxonDoctype extends StyleElement {
17
18     /**
19     * Determine whether this node is an instruction.
20     * @return true - it is an instruction
21     */

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

31
32     public boolean mayContainSequenceConstructor() {
33         return true;
34     }
35
36     public void prepareAttributes() throws XPathException {
37
38         AttributeCollection atts = getAttributeList();
39         for (int a=0; a<atts.getLength(); a++) {
40             int nc = atts.getNameCode(a);
41             checkUnknownAttribute(nc);
42         }
43
44     }
45
46     public void validate() throws XPathException {
47         checkWithinTemplate();
48     }
49
50     public Expression compile(Executable exec) throws XPathException {
51         Expression content = compileSequenceConstructor(exec, iterateAxis(Axis.CHILD), true);
52         if (content == null) {
53             content = EmptySequence.getInstance();
54         }
55         Doctype inst = new Doctype(content);
56         return inst;
57     }
58
59
60 }
61 //
62
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
63
// you may not use this file except in compliance with the License. You may obtain a copy of the
64
// License at http://www.mozilla.org/MPL/
65
//
66
// Software distributed under the License is distributed on an "AS IS" basis,
67
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
68
// See the License for the specific language governing rights and limitations under the License.
69
//
70
// The Original Code is: all this file.
71
//
72
// The Initial Developer of the Original Code is Michael H. Kay.
73
//
74
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
75
//
76
// Contributor(s): none.
77
//
78
Popular Tags