Package net.sf.saxon.trans
Class KeyDefinition
java.lang.Object
net.sf.saxon.expr.instruct.Actor
net.sf.saxon.trans.KeyDefinition
- All Implemented Interfaces:
SourceLocator
,ContextOriginator
,ExpressionOwner
,Location
,Locator
Corresponds to a single xsl:key declaration.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionKeyDefinition
(SymbolicName symbolicName, Pattern match, Expression use, String collationName, StringCollator collation) Constructor to create a key definition -
Method Summary
Modifier and TypeMethodDescriptionvoid
Allocate slot numbers to all the external component references in this componentvoid
export
(ExpressionPresenter presenter) Export expression structure.void
export
(ExpressionPresenter out, boolean reusable, Map<Component, Integer> componentIdMap) Diagnostic print of expression structure.Get the collation.Get the collation name for this key definition.Get the primitive item type of the values returned by the use expressiongetMatch()
Get the match pattern for the key definitionGet a name identifying the object of the expression, for example a function name, template name, variable name, key name, element name, etc.Get the symbolic name of the componentgetUse()
Get the use expression for the key definitionboolean
Test backwards compatibility modeboolean
Ask whether this is a composite keyboolean
Determine whether untypedAtomic values are converted to the type of the other operand.boolean
Ask whether this key is a range key, that is, a key capable of returning (a) the values in a selected range, and (b) the keys in orderboolean
Ask whether strict comparison is needed.void
setBackwardsCompatible
(boolean bc) Set backwards compatibility mode.void
setComposite
(boolean composite) Say whether this is a composite key.void
setConvertUntypedToOther
(boolean convertToOther) Indicate that untypedAtomic values should be converted to the type of the other operand, rather than to strings.void
setIndexedItemType
(BuiltInAtomicType itemType) Set the primitive item type of the values returned by the use expressionvoid
setLocation
(Location loc) Set the system Id and line number of the source xsl:key definitionvoid
setRangeKey
(boolean rangeKey) Say whether this key is a range key, that is, a key capable of returning (a) the values in a selected range, and (b) the keys in ordervoid
Set the map of local variables needed while evaluating the "use" expressionvoid
setStrictComparison
(boolean strict) Set whether strict comparison is needed.Methods inherited from class net.sf.saxon.expr.instruct.Actor
allocateBindingSlotsRecursive, getBody, getChildExpression, getColumnNumber, getComponentName, getDeclaredVisibility, getDeclaringComponent, getLineNumber, getLocation, getPackageData, getProperty, getPublicId, getRetainedStaticContext, getStackFrameMap, getSystemId, getTracingTag, isExportable, makeDeclaringComponent, obtainDeclaringComponent, process, saveLocation, setBody, setChildExpression, setColumnNumber, setDeclaredVisibility, setDeclaringComponent, setLineNumber, setPackageData, setRetainedStaticContext, setSystemId
-
Constructor Details
-
KeyDefinition
public KeyDefinition(SymbolicName symbolicName, Pattern match, Expression use, String collationName, StringCollator collation) Constructor to create a key definition- Parameters:
match
- the pattern in the xsl:key match attributeuse
- the expression in the xsl:key use attribute, or the expression that results from compiling the xsl:key contained instructions.collationName
- the name of the collation being usedcollation
- the actual collation. This must be one that supports generation of collation keys.
-
-
Method Details
-
getSymbolicName
Get the symbolic name of the component- Specified by:
getSymbolicName
in classActor
- Returns:
- the symbolic name
-
setRangeKey
public void setRangeKey(boolean rangeKey) Say whether this key is a range key, that is, a key capable of returning (a) the values in a selected range, and (b) the keys in order- Parameters:
rangeKey
- true if this is a range key; false if not
-
isRangeKey
public boolean isRangeKey()Ask whether this key is a range key, that is, a key capable of returning (a) the values in a selected range, and (b) the keys in order- Returns:
- true if this is a range key; false if not
-
setComposite
public void setComposite(boolean composite) Say whether this is a composite key. (If so, a sequence of atomic values in the use expression is taken as a single key value, rather than as a set of independent key values)- Parameters:
composite
- true if this is a composite key
-
isComposite
public boolean isComposite()Ask whether this is a composite key- Returns:
- true if the key is composite
-
setIndexedItemType
Set the primitive item type of the values returned by the use expression- Parameters:
itemType
- the primitive type of the indexed values
-
getIndexedItemType
Get the primitive item type of the values returned by the use expression- Returns:
- the primitive item type of the indexed values
-
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
-
isBackwardsCompatible
public boolean isBackwardsCompatible()Test backwards compatibility mode- Returns:
- true if running in XSLT backwards compatibility mode
-
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
-
isStrictComparison
public boolean isStrictComparison()Ask 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.
-
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
-
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
-
setStackFrameMap
Set the map of local variables needed while evaluating the "use" expression- Overrides:
setStackFrameMap
in classActor
-
allocateAllBindingSlots
Description copied from class:Actor
Allocate slot numbers to all the external component references in this component- Overrides:
allocateAllBindingSlots
in classActor
- Parameters:
pack
- the containing package
-
setLocation
Set the system Id and line number of the source xsl:key definition- Parameters:
loc
- the location
-
getMatch
Get the match pattern for the key definition- Returns:
- the pattern specified in the "match" attribute of the xsl:key declaration
-
getUse
Get the use expression for the key definition- Returns:
- the expression specified in the "use" attribute of the xsl:key declaration
-
obtainUseEvaluator
-
getCollationName
Get the collation name for this key definition.- Returns:
- the collation name (the collation URI)
-
getCollation
Get the collation.- Returns:
- the collation
-
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. -
export
public void export(ExpressionPresenter out, boolean reusable, Map<Component, Integer> componentIdMap) throws XPathExceptionDiagnostic print of expression structure. The abstract expression tree is written to the supplied outputstream.- Parameters:
out
- the expression presenter used to display the structure- Throws:
XPathException
-
export
Description copied from class:Actor
Export expression structure. The abstract expression tree is written to the supplied outputstream.- Specified by:
export
in classActor
- Parameters:
presenter
- the expression presenter used to generate the XML representation of the structure- Throws:
XPathException
- if things go wrong, for example an I/O failure
-