01: package net.sf.saxon.style;
02:
03: import net.sf.saxon.expr.Expression;
04: import net.sf.saxon.instruct.Executable;
05: import net.sf.saxon.type.ItemType;
06: import net.sf.saxon.om.AttributeCollection;
07: import net.sf.saxon.trans.XPathException;
08:
09: import javax.xml.transform.TransformerConfigurationException;
10:
11: /**
12: * Handler for xsl:matching-substring and xsl:non-matching-substring elements in stylesheet.
13: * New at XSLT 2.0<BR>
14: */
15:
16: public class XSLMatchingSubstring extends StyleElement {
17:
18: /**
19: * Determine the type of item returned by this instruction (only relevant if
20: * it is an instruction).
21: * @return the item type returned
22: */
23:
24: protected ItemType getReturnedItemType() {
25: return getCommonChildItemType();
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()
48: + " must be immediately within xsl:analyze-string",
49: "XTSE0010");
50: }
51: }
52:
53: public Expression compile(Executable exec) throws XPathException {
54: throw new UnsupportedOperationException(
55: "XSLMatchingSubstring#compile() should not be called");
56: }
57:
58: }
59:
60: //
61: // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
62: // you may not use this file except in compliance with the License. You may obtain a copy of the
63: // License at http://www.mozilla.org/MPL/
64: //
65: // Software distributed under the License is distributed on an "AS IS" basis,
66: // WITHOUT WARRANTY OF ANY KIND, either express or implied.
67: // See the License for the specific language governing rights and limitations under the License.
68: //
69: // The Original Code is: all this file.
70: //
71: // The Initial Developer of the Original Code is Michael H. Kay
72: //
73: // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
74: //
75: // Contributor(s): none.
76: //
|