net.sf.saxon.instruct

Class FixedAttribute

public final class FixedAttribute extends SimpleNodeConstructor

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.
voiddisplay(int level, NamePool pool, PrintStream out)
Display this instruction as an expression, for diagnostics
ItemevaluateItem(XPathContext context)
protected intevaluateNameCode(XPathContext context)
intgetCardinality()
InstructionInfogetInstructionInfo()
intgetInstructionNameCode()
Get the name of this instruction (return 'xsl:attribute')
ItemTypegetItemType(TypeHierarchy th)
voidlocalTypeCheck(StaticContext env, ItemType contextItemType)
TailCallprocessLeavingTail(XPathContext context)
Process this instruction
voidsetNoSpecialChars()
Indicate that the attribute value contains no special characters that might need escaping
voidsetRejectDuplicates()
Indicate that two attributes with the same name are not acceptable.
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 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.

display

public void display(int level, NamePool pool, PrintStream out)
Display this instruction as an expression, for diagnostics

evaluateItem

public Item evaluateItem(XPathContext context)

evaluateNameCode

protected int evaluateNameCode(XPathContext context)

getCardinality

public int getCardinality()

getInstructionInfo

public InstructionInfo getInstructionInfo()

getInstructionNameCode

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

getItemType

public ItemType getItemType(TypeHierarchy th)

localTypeCheck

public void localTypeCheck(StaticContext env, ItemType contextItemType)

processLeavingTail

public TailCall processLeavingTail(XPathContext context)
Process this instruction

Parameters: context the dynamic context of the transformation

Returns: a TailCall to be executed by the caller, always null for this instruction

setNoSpecialChars

public void setNoSpecialChars()
Indicate that the attribute value contains no special characters that might need escaping

setRejectDuplicates

public void setRejectDuplicates()
Indicate that two attributes with the same name are not acceptable. (This option is set in XQuery, but not in XSLT)

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

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