net.sf.saxon.trans

Class KeyDefinition

public class KeyDefinition extends Procedure implements Serializable

Corresponds to a single xsl:key declaration.

Author: Michael H. Kay

Constructor Summary
KeyDefinition(PatternFinder match, SequenceIterable use, String collationName, StringCollator collation)
Constructor to create a key definition
Method Summary
StringCollatorgetCollation()
Get the collation.
StringgetCollationName()
Get the collation name for this key definition.
intgetConstructType()
Get the type of construct.
BuiltInAtomicTypegetIndexedItemType()
Get the primitive item type of the values returned by the use expression
PatternFindergetMatch()
Get the match pattern for the key definition
StructuredQNamegetObjectName()
Get a name identifying the object of the expression, for example a function name, template name, variable name, key name, element name, etc.
SequenceIterablegetUse()
Get the use expression for the key definition
booleanisBackwardsCompatible()
Test backwards compatibility mode
booleanisConvertUntypedToOther()
Determine whether untypedAtomic values are converted to the type of the other operand.
booleanisStrictComparison()
Get whether strict comparison is needed.
voidsetBackwardsCompatible(boolean bc)
Set backwards compatibility mode.
voidsetBody(Expression body)
Set the body of the key (the use expression).
voidsetConvertUntypedToOther(boolean convertToOther)
Indicate that untypedAtomic values should be converted to the type of the other operand, rather than to strings.
voidsetIndexedItemType(BuiltInAtomicType itemType)
Set the primitive item type of the values returned by the use expression
voidsetLocation(String systemId, int lineNumber)
Set the system Id and line number of the source xsl:key definition
voidsetStackFrameMap(SlotManager map)
Set the map of local variables needed while evaluating the "use" expression
voidsetStrictComparison(boolean strict)
Set whether strict comparison is needed.

Constructor Detail

KeyDefinition

public KeyDefinition(PatternFinder match, SequenceIterable use, String collationName, StringCollator collation)
Constructor to create a key definition

Parameters: match the pattern in the xsl:key match attribute use the expression in the xsl:key use attribute, or the expression that results from compiling the xsl:key contained instructions. Note that a KeyDefinition constructed by the XSLT or XQuery parser will always use an Expression here; however, a KeyDefinition constructed at run-time by a compiled stylesheet or XQuery might use a simple ExpressionEvaluator that lacks all the compile-time information associated with an Expression collationName the name of the collation being used collation the actual collation. This must be one that supports generation of collation keys.

Method Detail

getCollation

public StringCollator getCollation()
Get the collation.

Returns: the collation

getCollationName

public String getCollationName()
Get the collation name for this key definition.

Returns: the collation name (the collation URI)

getConstructType

public int getConstructType()
Get the type of construct. This will either be the fingerprint of a standard XSLT instruction name (values in StandardNames: all less than 1024) or it will be a constant in class Location.

getIndexedItemType

public BuiltInAtomicType getIndexedItemType()
Get the primitive item type of the values returned by the use expression

Returns: the primitive item type of the indexed values

getMatch

public PatternFinder getMatch()
Get the match pattern for the key definition

Returns: the pattern specified in the "match" attribute of the xsl:key declaration

getObjectName

public StructuredQName getObjectName()
Get a name identifying the object of the expression, for example a function name, template name, variable name, key name, element name, etc. This is used only where the name is known statically.

getUse

public SequenceIterable getUse()
Get the use expression for the key definition

Returns: the expression specified in the "use" attribute of the xsl:key declaration

isBackwardsCompatible

public boolean isBackwardsCompatible()
Test backwards compatibility mode

Returns: true if running in XSLT backwards compatibility mode

isConvertUntypedToOther

public boolean isConvertUntypedToOther()
Determine whether untypedAtomic values are converted to the type of the other operand.

Returns: true if comparisons follow the semantics of the "=" operator rather than the "eq" operator

isStrictComparison

public boolean isStrictComparison()
Get whether strict comparison is needed. Strict comparison treats non-comparable values as an error rather than a no-match. This is used for internal keys that support value comparisons in Saxon-EE, it is not used for user-defined XSLT keys.

Returns: true if strict comparison is needed.

setBackwardsCompatible

public void setBackwardsCompatible(boolean bc)
Set backwards compatibility mode. The key definition is backwards compatible if ANY of the xsl:key declarations has version="1.0" in scope.

Parameters: bc set to true if running in XSLT 2.0 backwards compatibility mode

setBody

public void setBody(Expression body)
Set the body of the key (the use expression). This is held redundantly as an Expression and as a SequenceIterable (not sure why!)

Parameters: body the use expression of the key

setConvertUntypedToOther

public void setConvertUntypedToOther(boolean convertToOther)
Indicate that untypedAtomic values should be converted to the type of the other operand, rather than to strings. This is used for indexes constructed internally by Saxon-EE to support filter expressions that use the "=" operator, as distinct from "eq".

Parameters: convertToOther true if comparisons follow the semantics of the "=" operator rather than the "eq" operator

setIndexedItemType

public void setIndexedItemType(BuiltInAtomicType itemType)
Set the primitive item type of the values returned by the use expression

Parameters: itemType the primitive type of the indexed values

setLocation

public void setLocation(String systemId, int lineNumber)
Set the system Id and line number of the source xsl:key definition

Parameters: systemId the URI of the module containing the key definition lineNumber the line number of the key definition

setStackFrameMap

public void setStackFrameMap(SlotManager map)
Set the map of local variables needed while evaluating the "use" expression

setStrictComparison

public void setStrictComparison(boolean strict)
Set whether strict comparison is needed. Strict comparison treats non-comparable values as an error rather than a no-match. This is used for internal keys that support value comparisons in Saxon-EE, it is not used for user-defined XSLT keys.

Parameters: strict true if strict comparison is needed