KickJava   Java API By Example, From Geeks To Geeks.

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


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.type.ItemType;
5 import net.sf.saxon.om.AttributeCollection;
6 import net.sf.saxon.trans.XPathException;
7
8 import javax.xml.transform.TransformerConfigurationException JavaDoc;
9
10 /**
11 * Handler for xsl:matching-substring and xsl:non-matching-substring elements in stylesheet.
12 * New at XSLT 2.0<BR>
13 */

14
15 public class XSLMatchingSubstring extends StyleElement {
16
17     /**
18      * Determine the type of item returned by this instruction (only relevant if
19      * it is an instruction).
20      * @return the item type returned
21      */

22
23     protected ItemType getReturnedItemType() {
24         return getCommonChildItemType();
25     }
26
27
28     public void prepareAttributes() throws XPathException {
29         AttributeCollection atts = getAttributeList();
30         for (int a=0; a<atts.getLength(); a++) {
31             int nc = atts.getNameCode(a);
32             checkUnknownAttribute(nc);
33         }
34     }
35
36     /**
37     * Determine whether this type of element is allowed to contain a template-body
38     * @return true: yes, it may contain a template-body
39     */

40
41     public boolean mayContainSequenceConstructor() {
42         return true;
43     }
44
45     public void validate() throws XPathException {
46         if (!(getParent() instanceof XSLAnalyzeString)) {
47             compileError(getDisplayName() + " must be immediately within xsl:analyze-string", "XTSE0010");
48         }
49     }
50
51     public Expression compile(Executable exec) throws XPathException {
52         throw new UnsupportedOperationException JavaDoc("XSLMatchingSubstring#compile() should not be called");
53     }
54
55 }
56
57 //
58
// The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
59
// you may not use this file except in compliance with the License. You may obtain a copy of the
60
// License at http://www.mozilla.org/MPL/
61
//
62
// Software distributed under the License is distributed on an "AS IS" basis,
63
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
64
// See the License for the specific language governing rights and limitations under the License.
65
//
66
// The Original Code is: all this file.
67
//
68
// The Initial Developer of the Original Code is Michael H. Kay
69
//
70
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
71
//
72
// Contributor(s): none.
73
//
74
Popular Tags