net.sf.saxon.instruct

Class FixedAttribute

public final class FixedAttribute extends AttributeCreator

An instruction derived from an xsl:attribute element in stylesheet, or from an attribute constructor in XQuery. This version deals only with attributes whose name is known at compile time. It is also used for attributes of literal result elements. The value of the attribute is in general computed at run-time.
Constructor Summary
FixedAttribute(int nameCode, int validationAction, SimpleType schemaType, int annotation)
Construct an Attribute instruction
Method Summary
voidcheckPermittedContents(SchemaType parentType, StaticContext env, boolean whole)
Check that any elements and attributes constructed or returned by this expression are acceptable in the content model of a given complex type.
Expressioncopy()
Copy an expression.
ItemevaluateItem(XPathContext context)
intevaluateNameCode(XPathContext context)
voidexplain(ExpressionPresenter out)
Diagnostic print of expression structure.
intgetAttributeNameCode()
Get the name pool name code of the attribute to be constructed
intgetCardinality()
intgetInstructionNameCode()
Get the name of this instruction (return 'xsl:attribute')
ItemTypegetItemType(TypeHierarchy th)
voidlocalTypeCheck(ExpressionVisitor visitor, ItemType contextItemType)
voidsetSelect(Expression select, Configuration config)
Set the expression defining the value of the attribute.

Constructor Detail

FixedAttribute

public FixedAttribute(int nameCode, int validationAction, SimpleType schemaType, int annotation)
Construct an Attribute instruction

Parameters: nameCode Represents the attribute name validationAction the validation required, for example strict or lax schemaType the schema type against which validation is required, null if not applicable annotation Integer code identifying the type named in the type attribute of the instruction - zero if the attribute was not present

Method Detail

checkPermittedContents

public void checkPermittedContents(SchemaType parentType, StaticContext env, boolean whole)
Check that any elements and attributes constructed or returned by this expression are acceptable in the content model of a given complex type. It's always OK to say yes, since the check will be repeated at run-time. The process of checking element and attribute constructors against the content model of a complex type also registers the type of content expected of those constructors, so the static validation can continue recursively.

copy

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

Returns: the copy of the original expression

evaluateItem

public Item evaluateItem(XPathContext context)

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.

getAttributeNameCode

public int getAttributeNameCode()
Get the name pool name code of the attribute to be constructed

Returns: the attribute's name code

getCardinality

public int getCardinality()

getInstructionNameCode

public int getInstructionNameCode()
Get the name of this instruction (return 'xsl:attribute')

getItemType

public ItemType getItemType(TypeHierarchy th)

localTypeCheck

public void localTypeCheck(ExpressionVisitor visitor, ItemType contextItemType)

setSelect

public void setSelect(Expression select, Configuration config)
Set the expression defining the value of the attribute. If this is a constant, and if validation against a schema type was requested, the validation is done immediately.

Parameters: select The expression defining the content of the attribute config The Saxon configuration

Throws: XPathException if the expression is a constant, and validation is requested, and the constant doesn't match the required type.