/** * Examine a text node in the stylesheet to see if it is a text value template * * @param node the text node * @throws XPathException if the node is is a text value template with variable content */ private boolean examineTextNode(NodeInfo node) throws XPathException { if (node instanceof TextValueTemplateNode) { ((TextValueTemplateNode) node).validate(); return !(((TextValueTemplateNode) node).getContentExpression() instanceof Literal); } else { return false; } }
public TextValueTemplateContext getStaticContext() { if (staticContext == null) { staticContext = new TextValueTemplateContext((StyleElement) getParent(), this); } return staticContext; }
public void validate() throws XPathException { contentExp = AttributeValueTemplate.make(getStringValue(), getStaticContext()); contentExp = new ValueOf(contentExp, false, true); contentExp.setRetainedStaticContext(((StyleElement)getParent()).makeRetainedStaticContext()); contentExp = ((StyleElement)getParent()).typeCheck("tvt", contentExp); } }
/** * Make a text node * * @param parent the parent element * @param content the content of the text node * @return the constructed text node */ public TextImpl makeTextNode(NodeInfo parent, CharSequence content) { if (parent instanceof StyleElement && ((StyleElement) parent).isExpandingText()) { return new TextValueTemplateNode(content.toString()); } else { return new TextImpl(content.toString()); } }
/** * Compile a content value text node. * * @param node the text node potentially containing the template * @param contents a list to which expressions representing the fixed and variable parts of the content template * will be appended */ public void compileContentValueTemplate(TextImpl node, List<Expression> contents) { if (node instanceof TextValueTemplateNode) { Expression exp = ((TextValueTemplateNode) node).getContentExpression(); if (getConfiguration().getBooleanProperty(Feature.STRICT_STREAMABILITY) && !(exp instanceof Literal)) { exp = new SequenceInstr(exp); } contents.add(exp); } else { contents.add(new StringLiteral(node.getStringValue())); } }
public void validate() throws XPathException { contentExp = AttributeValueTemplate.make(getStringValue(), getStaticContext()); contentExp = new ValueOf(contentExp, false, true); contentExp.setRetainedStaticContext(((StyleElement)getParent()).makeRetainedStaticContext()); contentExp = ((StyleElement)getParent()).typeCheck("tvt", contentExp); } }
/** * Make a text node * * @param parent the parent element * @param content the content of the text node * @return the constructed text node */ public TextImpl makeTextNode(NodeInfo parent, CharSequence content) { if (parent instanceof StyleElement && ((StyleElement) parent).isExpandingText()) { return new TextValueTemplateNode(content.toString()); } else { return new TextImpl(content.toString()); } }
/** * Compile a content value text node. * * @param node the text node potentially containing the template * @param contents a list to which expressions representing the fixed and variable parts of the content template * will be appended */ public void compileContentValueTemplate(TextImpl node, List<Expression> contents) { if (node instanceof TextValueTemplateNode) { Expression exp = ((TextValueTemplateNode) node).getContentExpression(); if (getConfiguration().getBooleanProperty(Feature.STRICT_STREAMABILITY) && !(exp instanceof Literal)) { exp = new SequenceInstr(exp); } contents.add(exp); } else { contents.add(new StringLiteral(node.getStringValue())); } }
/** * Examine a text node in the stylesheet to see if it is a text value template * * @param node the text node * @throws XPathException if the node is is a text value template with variable content */ private boolean examineTextNode(NodeInfo node) throws XPathException { if (node instanceof TextValueTemplateNode) { ((TextValueTemplateNode) node).validate(); return !(((TextValueTemplateNode) node).getContentExpression() instanceof Literal); } else { return false; } }
public TextValueTemplateContext getStaticContext() { if (staticContext == null) { staticContext = new TextValueTemplateContext((StyleElement) getParent(), this); } return staticContext; }