Debian Codegraph @

net/sf/saxon/style/TextValueTemplateNode.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.instruct.ValueOf;
12 import net.sf.saxon.trans.XPathException;
13 import net.sf.saxon.tree.linked.TextImpl;
14
15 /**
16 * A text node in an XSLT 3.0 stylesheet that may or may not contain a text value template
17 */
18 public class TextValueTemplateNode extends TextImpl {
19
20 private Expression contentExp;
21 private TextValueTemplateContext staticContext;
22
23 public TextValueTemplateNode(String value) {
24 super(value);
25 }
26
27 public Expression getContentExpression() {
28 return contentExp;
29 }
30
31 public TextValueTemplateContext getStaticContext() {
32 if (staticContext == null) {
33 staticContext = new TextValueTemplateContext((StyleElement) getParent(), this);
34 }
35 return staticContext;
36 }
37
38 public void validate() throws XPathException {
39 contentExp = AttributeValueTemplate.make(getStringValue(), getStaticContext());
40 contentExp = new ValueOf(contentExp, false, true);
41 contentExp.setRetainedStaticContext(((StyleElement)getParent()).makeRetainedStaticContext());
42 contentExp = ((StyleElement)getParent()).typeCheck("tvt", contentExp);
43 }
44 }
45