Package com.icl.saxon.style
Class ExpressionContext
- java.lang.Object
-
- com.icl.saxon.style.ExpressionContext
-
- All Implemented Interfaces:
StaticContext
public class ExpressionContext extends java.lang.Object implements StaticContext
An ExpressionContext represents the context for an XPath expression written in the stylesheet.
-
-
Constructor Summary
Constructors Constructor Description ExpressionContext(StyleElement styleElement)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
allowsKeyFunction()
Determine whether the key() function is permmitted in this contextBinding
bindVariable(int fingerprint)
Bind a variable to an object that can be used to refer to itboolean
forwardsCompatibleModeIsEnabled()
Determine whether forwards-compatible mode is enabledjava.lang.String
getBaseURI()
Get the Base URI of the element containing the expression, for resolving any relative URI's used in the expression.java.lang.Class
getExternalJavaClass(java.lang.String uri)
Get an external Java class corresponding to a given namespace prefix, if there is one.int
getFingerprint(java.lang.String qname, boolean useDefault)
Get a fingerprint for a name, using this as the context for namespace resolutionint
getLineNumber()
Get the line number of the expression within its containing entity Returns -1 if no line number is availableFunction
getStyleSheetFunction(int fingerprint)
java.lang.String
getSystemId()
Get the System ID of the entity containing the expression (used for diagnostics)java.lang.String
getURIForPrefix(java.lang.String prefix)
Get the URI for a prefix, using this Element as the context for namespace resolutionjava.lang.String
getVersion()
Get the effective XSLT version in this region of the stylesheetboolean
isElementAvailable(java.lang.String qname)
Determine if an extension element is availableboolean
isExtensionNamespace(short uriCode)
Determine whether a given URI code identifies an extension element namespaceboolean
isFunctionAvailable(java.lang.String qname)
Determine if a function is availableint
makeNameCode(java.lang.String qname, boolean useDefault)
Make a NameCode, using this Element as the context for namespace resolutionNamespaceTest
makeNamespaceTest(short nodeType, java.lang.String prefix)
Make a NamespaceTest, using this element as the context for namespace resolutionNameTest
makeNameTest(short nodeType, java.lang.String qname, boolean useDefault)
Make a NameTest, using this element as the context for namespace resolutionStaticContext
makeRuntimeContext(NamePool pool)
Create a context for parsing XPath expressions at runtime, using this styelsheet element for namespace declarations, variables, etc, but using the runtime NamePooljava.lang.String
toString()
String representation for diagnostics
-
-
-
Constructor Detail
-
ExpressionContext
public ExpressionContext(StyleElement styleElement)
-
-
Method Detail
-
makeRuntimeContext
public StaticContext makeRuntimeContext(NamePool pool)
Create a context for parsing XPath expressions at runtime, using this styelsheet element for namespace declarations, variables, etc, but using the runtime NamePool- Specified by:
makeRuntimeContext
in interfaceStaticContext
-
getSystemId
public java.lang.String getSystemId()
Get the System ID of the entity containing the expression (used for diagnostics)- Specified by:
getSystemId
in interfaceStaticContext
-
getLineNumber
public int getLineNumber()
Get the line number of the expression within its containing entity Returns -1 if no line number is available- Specified by:
getLineNumber
in interfaceStaticContext
-
getBaseURI
public java.lang.String getBaseURI()
Get the Base URI of the element containing the expression, for resolving any relative URI's used in the expression. Used by the document() function.- Specified by:
getBaseURI
in interfaceStaticContext
-
getURIForPrefix
public java.lang.String getURIForPrefix(java.lang.String prefix) throws XPathException
Get the URI for a prefix, using this Element as the context for namespace resolution- Specified by:
getURIForPrefix
in interfaceStaticContext
- Parameters:
prefix
- The prefix- Throws:
XPathException
-
makeNameCode
public final int makeNameCode(java.lang.String qname, boolean useDefault) throws XPathException
Make a NameCode, using this Element as the context for namespace resolution- Specified by:
makeNameCode
in interfaceStaticContext
- Parameters:
qname
- The name as written, in the form "[prefix:]localname"- Throws:
XPathException
-
getFingerprint
public int getFingerprint(java.lang.String qname, boolean useDefault) throws XPathException
Get a fingerprint for a name, using this as the context for namespace resolution- Specified by:
getFingerprint
in interfaceStaticContext
- Parameters:
qname
- The name as written, in the form "[prefix:]localname"- Returns:
- -1 if the name is not already present in the name pool
- Throws:
XPathException
-
makeNameTest
public NameTest makeNameTest(short nodeType, java.lang.String qname, boolean useDefault) throws XPathException
Make a NameTest, using this element as the context for namespace resolution- Specified by:
makeNameTest
in interfaceStaticContext
- Throws:
XPathException
-
makeNamespaceTest
public NamespaceTest makeNamespaceTest(short nodeType, java.lang.String prefix) throws XPathException
Make a NamespaceTest, using this element as the context for namespace resolution- Specified by:
makeNamespaceTest
in interfaceStaticContext
- Throws:
XPathException
-
bindVariable
public Binding bindVariable(int fingerprint) throws XPathException
Bind a variable to an object that can be used to refer to it- Specified by:
bindVariable
in interfaceStaticContext
- Parameters:
fingerprint
- The fingerprint of the variable name- Returns:
- a Binding object that can be used to identify it in the Bindery
- Throws:
XPathException
- if the variable has not been declared
-
isExtensionNamespace
public boolean isExtensionNamespace(short uriCode) throws XPathException
Determine whether a given URI code identifies an extension element namespace- Specified by:
isExtensionNamespace
in interfaceStaticContext
- Throws:
XPathException
-
forwardsCompatibleModeIsEnabled
public boolean forwardsCompatibleModeIsEnabled() throws XPathException
Determine whether forwards-compatible mode is enabled- Specified by:
forwardsCompatibleModeIsEnabled
in interfaceStaticContext
- Throws:
XPathException
-
getStyleSheetFunction
public Function getStyleSheetFunction(int fingerprint) throws XPathException
- Specified by:
getStyleSheetFunction
in interfaceStaticContext
- Throws:
XPathException
-
getExternalJavaClass
public java.lang.Class getExternalJavaClass(java.lang.String uri) throws javax.xml.transform.TransformerException
Get an external Java class corresponding to a given namespace prefix, if there is one.- Specified by:
getExternalJavaClass
in interfaceStaticContext
- Parameters:
uri
- The namespace URI corresponding to the prefix used in the function call.- Returns:
- the Java class name if a suitable class exists, otherwise return null.
- Throws:
javax.xml.transform.TransformerException
- if the class is found, but cannot be loaded.
-
isElementAvailable
public boolean isElementAvailable(java.lang.String qname) throws XPathException
Determine if an extension element is available- Specified by:
isElementAvailable
in interfaceStaticContext
- Throws:
XPathException
- if the name is invalid or the prefix is not declared
-
isFunctionAvailable
public boolean isFunctionAvailable(java.lang.String qname) throws XPathException
Determine if a function is available- Specified by:
isFunctionAvailable
in interfaceStaticContext
- Throws:
XPathException
-
allowsKeyFunction
public boolean allowsKeyFunction()
Determine whether the key() function is permmitted in this context- Specified by:
allowsKeyFunction
in interfaceStaticContext
-
getVersion
public java.lang.String getVersion()
Get the effective XSLT version in this region of the stylesheet- Specified by:
getVersion
in interfaceStaticContext
-
toString
public java.lang.String toString()
String representation for diagnostics- Overrides:
toString
in classjava.lang.Object
-
-