net.sf.saxon.instruct

Class ProcessingInstruction

public class ProcessingInstruction extends SimpleNodeConstructor

An xsl:processing-instruction element in the stylesheet, or a processing-instruction constructor in a query
Constructor Summary
ProcessingInstruction(Expression name)
Create an xsl:processing-instruction instruction
Method Summary
protected StringcheckContent(String data, XPathContext context)
Check the content of the node, and adjust it if necessary
Expressioncopy()
Copy an expression.
intevaluateNameCode(XPathContext context)
voidexplain(ExpressionPresenter out)
Diagnostic print of expression structure.
intgetCardinality()
intgetDependencies()
intgetInstructionNameCode()
Get the name of this instruction for diagnostic and tracing purposes
ItemTypegetItemType(TypeHierarchy th)
ExpressiongetNameExpression()
Get the expression that defines the processing instruction name
Iterator<Expression>iterateSubExpressions()
voidlocalTypeCheck(ExpressionVisitor visitor, ItemType contextItemType)
voidprocessValue(CharSequence value, XPathContext context)
Process the value of the node, to create the new node.
protected voidpromoteInst(PromotionOffer offer)
Offer promotion for subexpressions.
booleanreplaceSubExpression(Expression original, Expression replacement)
Replace one subexpression by a replacement subexpression
Expressionsimplify(ExpressionVisitor visitor)

Constructor Detail

ProcessingInstruction

public ProcessingInstruction(Expression name)
Create an xsl:processing-instruction instruction

Parameters: name the expression used to compute the name of the generated processing-instruction

Method Detail

checkContent

protected String checkContent(String data, XPathContext context)
Check the content of the node, and adjust it if necessary

Parameters: data the supplied content

Returns: the original content, unless adjustments are needed

Throws: XPathException if the content is invalid

copy

public Expression copy()
Copy an expression. This makes a deep copy.

Returns: the copy of the original expression

evaluateNameCode

public int evaluateNameCode(XPathContext context)

explain

public void explain(ExpressionPresenter out)
Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.

getCardinality

public int getCardinality()

getDependencies

public int getDependencies()

getInstructionNameCode

public int getInstructionNameCode()
Get the name of this instruction for diagnostic and tracing purposes

Returns: the string "xsl:processing-instruction"

getItemType

public ItemType getItemType(TypeHierarchy th)

getNameExpression

public Expression getNameExpression()
Get the expression that defines the processing instruction name

Returns: the expression that defines the processing instruction name

iterateSubExpressions

public Iterator<Expression> iterateSubExpressions()

localTypeCheck

public void localTypeCheck(ExpressionVisitor visitor, ItemType contextItemType)

processValue

public void processValue(CharSequence value, XPathContext context)
Process the value of the node, to create the new node.

Parameters: value the string value of the new node context the dynamic evaluation context

Throws: XPathException

promoteInst

protected void promoteInst(PromotionOffer offer)
Offer promotion for subexpressions. The offer will be accepted if the subexpression is not dependent on the factors (e.g. the context item) identified in the PromotionOffer. By default the offer is not accepted - this is appropriate in the case of simple expressions such as constant values and variable references where promotion would give no performance advantage. This method is always called at compile time.

Parameters: offer details of the offer, for example the offer to move expressions that don't depend on the context to an outer level in the containing expression

Throws: XPathException if any error is detected

replaceSubExpression

public boolean replaceSubExpression(Expression original, Expression replacement)
Replace one subexpression by a replacement subexpression

Parameters: original the original subexpression replacement the replacement subexpression

Returns: true if the original subexpression is found

simplify

public Expression simplify(ExpressionVisitor visitor)