Package net.sf.saxon.trans
Class KeyDefinition
- java.lang.Object
-
- net.sf.saxon.expr.instruct.Actor
-
- net.sf.saxon.trans.KeyDefinition
-
- All Implemented Interfaces:
javax.xml.transform.SourceLocator
,ContextOriginator
,ExpressionOwner
,Location
,org.xml.sax.Locator
public class KeyDefinition extends Actor implements ContextOriginator
Corresponds to a single xsl:key declaration.
-
-
Constructor Summary
Constructors Constructor Description KeyDefinition(SymbolicName symbolicName, Pattern match, Expression use, java.lang.String collationName, StringCollator collation)
Constructor to create a key definition
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
allocateAllBindingSlots(StylesheetPackage pack)
Allocate slot numbers to all the external component references in this componentvoid
export(ExpressionPresenter presenter)
Export expression structure.void
export(ExpressionPresenter out, boolean reusable, java.util.Map<Component,java.lang.Integer> componentIdMap)
Diagnostic print of expression structure.StringCollator
getCollation()
Get the collation.java.lang.String
getCollationName()
Get the collation name for this key definition.BuiltInAtomicType
getIndexedItemType()
Get the primitive item type of the values returned by the use expressionPattern
getMatch()
Get the match pattern for the key definitionStructuredQName
getObjectName()
Get a name identifying the object of the expression, for example a function name, template name, variable name, key name, element name, etc.SymbolicName
getSymbolicName()
Get the symbolic name of the componentExpression
getUse()
Get the use expression for the key definitionboolean
isBackwardsCompatible()
Test backwards compatibility modeboolean
isComposite()
Ask whether this is a composite keyboolean
isConvertUntypedToOther()
Determine whether untypedAtomic values are converted to the type of the other operand.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 orderboolean
isStrictComparison()
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(java.lang.String systemId, int lineNumber, int columnNumber)
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
setStackFrameMap(SlotManager map)
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, getProperties, getProperty, getPublicId, getRetainedStaticContext, getStackFrameMap, getSystemId, getTracingTag, isExportable, makeDeclaringComponent, obtainDeclaringComponent, saveLocation, setBody, setChildExpression, setColumnNumber, setDeclaredVisibility, setDeclaringComponent, setLineNumber, setPackageData, setRetainedStaticContext, setSystemId
-
-
-
-
Constructor Detail
-
KeyDefinition
public KeyDefinition(SymbolicName symbolicName, Pattern match, Expression use, java.lang.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 Detail
-
getSymbolicName
public SymbolicName 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
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
-
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
-
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
public void setStackFrameMap(SlotManager map)
Set the map of local variables needed while evaluating the "use" expression- Overrides:
setStackFrameMap
in classActor
-
allocateAllBindingSlots
public void allocateAllBindingSlots(StylesheetPackage pack)
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
public void setLocation(java.lang.String systemId, int lineNumber, int columnNumber)
Set the system Id and line number of the source xsl:key definition- Parameters:
systemId
- the URI of the module containing the key definitionlineNumber
- the line number of the key definitioncolumnNumber
- the column number of the key definition
-
getMatch
public Pattern getMatch()
Get the match pattern for the key definition- Returns:
- the pattern specified in the "match" attribute of the xsl:key declaration
-
getUse
public Expression getUse()
Get the use expression for the key definition- Returns:
- the expression specified in the "use" attribute of the xsl:key declaration
-
getCollationName
public java.lang.String getCollationName()
Get the collation name for this key definition.- Returns:
- the collation name (the collation URI)
-
getCollation
public StringCollator getCollation()
Get the collation.- Returns:
- the collation
-
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.
-
export
public void export(ExpressionPresenter out, boolean reusable, java.util.Map<Component,java.lang.Integer> componentIdMap) throws XPathException
Diagnostic 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
public void export(ExpressionPresenter presenter) throws XPathException
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
-
-