## net.sf.saxon.instruct
Class Procedure

    java.lang.Object
      net.sf.saxon.instruct.Procedure

All Implemented Interfaces:
  java.io.Serializable, javax.xml.transform.SourceLocator, LocationProvider, SaxonLocator, Container, InstructionInfo, org.xml.sax.Locator

Direct Known Subclasses:
  AttributeSet, KeyDefinition, Template, UserFunction

    public abstract class Procedure

extends java.lang.Object
implements java.io.Serializable, Container, InstructionInfo, LocationProvider

This object represents the compiled form of a user-written function, template, attribute-set, etc (the source can be either an XSLT stylesheet function or an XQuery function).

It is assumed that type-checking, of both the arguments and the results, has been handled at compile time. That is, the expression supplied as the body of the function must be wrapped in code to check or convert the result to the required type, and calls on the function must be wrapped at compile time to check or convert the supplied arguments.

See Also:
  Serialized Form

Field Summary
`protected Expression` `body`

Constructor Summary
`Procedure()`

Method Summary
`Expression` `getBody()`
`int` `getColumnNumber()`
`int` `getColumnNumber(long locationId)` Get the column number within the document or module containing a particular location
`Executable` `getExecutable()` Get the Executable (representing a complete stylesheet or query) of which this Container forms part
`int` `getHostLanguage()` Get the host language (XSLT, XQuery, XPath) used to implement the code in this container
`int` `getLineNumber()` Get the line number of the instruction in the source stylesheet module.
`int` `getLineNumber(long locationId)` Get the line number within the document or module containing a particular location
`LocationProvider` `getLocationProvider()` Get the LocationProvider allowing location identifiers to be resolved.
`java.util.Iterator` `getProperties()` Get an iterator over all the properties available.
`java.lang.Object` `getProperty(java.lang.String name)` Get the value of a particular property of the instruction.
`java.lang.String` `getPublicId()`
`SlotManager` `getStackFrameMap()`
`java.lang.String` `getSystemId()` Get the system identifier (URI) of the source stylesheet or query module containing the instruction.
`java.lang.String` `getSystemId(long locationId)` Get the URI of the document or module containing a particular location
`boolean` `replaceSubExpression(Expression original, Expression replacement)` Replace one subexpression by a replacement subexpression
`void` `setBody(Expression body)`
`void` `setExecutable(Executable executable)`
`void` `setHostLanguage(int language)`
`void` `setLineNumber(int lineNumber)`
`void` `setStackFrameMap(SlotManager map)`
`void` `setSystemId(java.lang.String systemId)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface net.sf.saxon.trace.InstructionInfo
`getConstructType, getObjectName`

Field Detail

### body

    protected Expression body

Constructor Detail

### Procedure

    public Procedure()

Method Detail

### setBody

    public void setBody(Expression body)

### setHostLanguage

    public void setHostLanguage(int language)

### getHostLanguage

    public int getHostLanguage()

  Description copied from interface: `Container`
  Get the host language (XSLT, XQuery, XPath) used to implement the code in this container

  Specified by:
    `getHostLanguage` in interface `Container`
  Returns:
    typically `Configuration.XSLT` or `Configuration.XQUERY`

### getBody

    public final Expression getBody()

### replaceSubExpression

    public boolean replaceSubExpression(Expression original,
                                        Expression replacement)

  Replace one subexpression by a replacement subexpression

  Specified by:
    `replaceSubExpression` in interface `Container`
  Parameters:
    `original` - the original subexpression
    `replacement` - the replacement subexpression
  Returns:
    true if the original subexpression is found

### setStackFrameMap

    public void setStackFrameMap(SlotManager map)

### getStackFrameMap

    public SlotManager getStackFrameMap()

### getExecutable

    public final Executable getExecutable()

  Description copied from interface: `Container`
  Get the Executable (representing a complete stylesheet or query) of which this Container forms part

  Specified by:
    `getExecutable` in interface `Container`
  Returns:
    the executable

### setExecutable

    public void setExecutable(Executable executable)

### getLocationProvider

    public LocationProvider getLocationProvider()

  Get the LocationProvider allowing location identifiers to be resolved.

  Specified by:
    `getLocationProvider` in interface `Container`
  Returns:
    the location provider

### setLineNumber

    public void setLineNumber(int lineNumber)

### setSystemId

    public void setSystemId(java.lang.String systemId)

### getLineNumber

    public int getLineNumber()

  Description copied from interface: `InstructionInfo`
  Get the line number of the instruction in the source stylesheet module. If this is not known, or if the instruction is an artificial one that does not relate to anything in the source code, the value returned may be -1.

  Specified by:
    `getLineNumber` in interface `javax.xml.transform.SourceLocator`
  Specified by:
    `getLineNumber` in interface `InstructionInfo`
  Specified by:
    `getLineNumber` in interface `org.xml.sax.Locator`
  Returns:
    the line number of the expression within the containing module

### getSystemId

    public java.lang.String getSystemId()

  Description copied from interface: `InstructionInfo`
  Get the system identifier (URI) of the source stylesheet or query module containing the instruction. This will generally be an absolute URI. If the system identifier is not known, the method may return null. In some cases, for example where XML external entities are used, the correct system identifier is not always retained.

  Specified by:
    `getSystemId` in interface `javax.xml.transform.SourceLocator`
  Specified by:
    `getSystemId` in interface `InstructionInfo`
  Specified by:
    `getSystemId` in interface `org.xml.sax.Locator`
  Returns:
    the URI of the containing module

### getColumnNumber

    public int getColumnNumber()

  Specified by:
    `getColumnNumber` in interface `javax.xml.transform.SourceLocator`
  Specified by:
    `getColumnNumber` in interface `org.xml.sax.Locator`

### getPublicId

    public java.lang.String getPublicId()

  Specified by:
    `getPublicId` in interface `javax.xml.transform.SourceLocator`
  Specified by:
    `getPublicId` in interface `org.xml.sax.Locator`

### getSystemId

    public java.lang.String getSystemId(long locationId)

  Description copied from interface: `LocationProvider`
  Get the URI of the document or module containing a particular location

  Specified by:
    `getSystemId` in interface `LocationProvider`
  Parameters:
    `locationId` - identifier of the location in question (as passed down the Receiver pipeline)
  Returns:
    the URI of the document or module.

### getLineNumber

    public int getLineNumber(long locationId)

  Description copied from interface: `LocationProvider`
  Get the line number within the document or module containing a particular location

  Specified by:
    `getLineNumber` in interface `LocationProvider`
  Parameters:
    `locationId` - identifier of the location in question (as passed down the Receiver pipeline)
  Returns:
    the line number within the document or module.

### getColumnNumber

    public int getColumnNumber(long locationId)

  Description copied from interface: `LocationProvider`
  Get the column number within the document or module containing a particular location

  Specified by:
    `getColumnNumber` in interface `LocationProvider`
  Parameters:
    `locationId` - identifier of the location in question (as passed down the Receiver pipeline)
  Returns:
    the column number within the document or module, or -1 if this is not available

### getProperty

    public java.lang.Object getProperty(java.lang.String name)

  Description copied from interface: `InstructionInfo`
  Get the value of a particular property of the instruction. Properties of XSLT instructions are generally known by the name of the stylesheet attribute that defines them.

  Specified by:
    `getProperty` in interface `InstructionInfo`
  Parameters:
    `name` - The name of the required property
  Returns:
    The value of the requested property, or null if the property is not available

### getProperties

    public java.util.Iterator getProperties()

  Get an iterator over all the properties available. The values returned by the iterator will be of type String, and each string can be supplied as input to the getProperty() method to retrieve the value of the property. The iterator may return properties whose value is null.

  Specified by:
    `getProperties` in interface `InstructionInfo`
  Returns:
    an iterator over the properties.

Copyright (c) Saxonica Limited. All rights reserved.