Debian Codegraph @

net/sf/saxon/style/XSLProcessingInstruction.java

raw symbols SCIP
1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2018 Saxonica Limited.
3 // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4 // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7
8 package net.sf.saxon.style;
9
10 import net.sf.saxon.expr.Expression;
11 import net.sf.saxon.expr.StringLiteral;
12 import net.sf.saxon.expr.instruct.ProcessingInstruction;
13 import net.sf.saxon.trans.XPathException;
14 import net.sf.saxon.value.StringValue;
15
16 /**
17 * An xsl:processing-instruction element in the stylesheet.
18 */
19
20 public class XSLProcessingInstruction extends XSLLeafNodeConstructor {
21
22 Expression name;
23
24 public void prepareAttributes() throws XPathException {
25 name = prepareAttributesNameAndSelect();
26 }
27
28 public void validate(ComponentDeclaration decl) throws XPathException {
29 name = typeCheck("name", name);
30 select = typeCheck("select", select);
31 super.validate(decl);
32 }
33
34 /**
35 * Get the error code to be returned when the element has a select attribute but is not empty.
36 *
37 * @return the error code defined for this condition, for this particular instruction
38 */
39
40 protected String getErrorCodeForSelectPlusContent() {
41 return "XTSE0880";
42 }
43
44 public Expression compile(Compilation exec, ComponentDeclaration decl) throws XPathException {
45 ProcessingInstruction inst = new ProcessingInstruction(name);
46 compileContent(exec, decl, inst, new StringLiteral(StringValue.SINGLE_SPACE));
47 return inst;
48 }
49
50 }
51