Class KeyDefinition

java.lang.Object
net.sf.saxon.expr.instruct.Actor
net.sf.saxon.trans.KeyDefinition
All Implemented Interfaces:
SourceLocator, ContextOriginator, ExpressionOwner, Location, Locator

public class KeyDefinition extends Actor implements ContextOriginator
Corresponds to a single xsl:key declaration.
  • 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 attribute
      use - 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 used
      collation - the actual collation. This must be one that supports generation of collation keys.
  • Method Details

    • getSymbolicName

      public SymbolicName getSymbolicName()
      Get the symbolic name of the component
      Specified by:
      getSymbolicName in class Actor
      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 class Actor
    • 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 class Actor
      Parameters:
      pack - the containing package
    • setLocation

      public void setLocation(Location loc)
      Set the system Id and line number of the source xsl:key definition
      Parameters:
      loc - the location
    • 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
    • obtainUseEvaluator

      public PullEvaluator obtainUseEvaluator()
    • getCollationName

      public 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, Map<Component,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 class Actor
      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