You can use the CompileXSLT tool to precompile one or more
stylesheets, use the CompileXPath tool to precompile one or more XPath
expressions, and use the CompileXQuery tool to precompile one or more
XQuery expressions.
About this task
Note: See
Precompiling using ANT tasks for
information about using the TaskCompileXPath, TaskCompileXQuery, and
TaskCompileXSLT ANT tasks as alternatives to using the CompileXPath,
CompileXQuery, and CompileXSLT commands.
Procedure
- Compile XSLT
- Location
- The product includes the following script that sets up the environment
and invokes the tool.
- Syntax
- Parameters
- -out output
- Uses the name output as the base name for the
generated classes
By default, the base name is XSLTModule.
This
option is ignored if compiling multiple stylesheets.
- -dir directory
- Specifies a destination directory for the generated classes
The
default is the current working directory.
- -pkg package
- Specifies a package name prefix for all generated classes
The
default is the Java default
package.
- -func name=funcName type=funcType argtype=argType
- Adds a function binding to the static context for a single item
This
simply declares the function, and a method object for the function
also must be bound to the dynamic context at execution time.
- funcName
- Specifies the name of the function (expressed localPart,namespaceURI)
- funcType
- Specifies the return type of the function (expressed localPart,namespaceURI)
- argType
- Specifies the types of the function arguments (expressed localPart,namespaceURI)
and is optional
This option can be used multiple times.
If the value of any option contains a blank space,
enclose it in quotation marks.
This option can be used multiple
times.
For example:
-func name=getId,http://example.org type=integer,http://www.w3.org/2001/XMLSchema argtype=string,http://www.w3.org/2001/XMLSchema
- -baseURI URI
- Specifies the base URI of the containing element
- -imm int
- Sets the integer math mode, which is a constant representing the
level of precision required and whether overflow detection is required
when working with xs:integer values
Valid values include:
- 1
- Values need only support the minimum precision required for a
minimally conforming processor (18 digits).
- 2
- Values should support an arbitrary number of digits of precision;
no overflow should occur.
- 3
- Values need only support the minimum precision required for a
minimally conforming processor (18 digits); but any overflow condition
should be detected and error FOAR0002 should be raised.
- -i
- Forces the compiler to read the stylesheet from standard in
- -v
- Prints the version of the compiler
- -h
- Prints the usage statement
- stylesheet
- Full path to a file containing an XSL stylesheet to be compiled
The following is a basic example
of compiling a stylesheet using the CompileXSLT tool:
- Compile an XPath expression
- Location
- The product includes the following script that sets up the environment
and invokes the tool.
- Syntax
- Parameters
- -out output
- Uses the name output as the base name for the
generated classes
By default, the base is XPathModule.
This
option is ignored if compiling multiple expressions.
- -dir directory
- Specifies a destination directory for the generated executable
The
default is the current working directory.
- -pkg package
- Specifies a package name prefix for all generated classes
The
default is the Java default
package.
- -cpm mode
- Specifies an alternate XPath compatibility mode.
For example,
use 1.0 for compatibility with XPath Version 1.0.
- -ns prefix=URI
- Specifies a namespace for use during static processing
If the
value of any option contains a blank space, enclose it in quotation
marks.
This option can be used multiple times. In the case of
multiple -ns arguments with the same prefix, the last one prevails.
- -schema URI
- Specifies any schema document that is used to populate the in-scope
schema definitions
This option can be used multiple times.
- -func name=funcName type=funcType argtype=argType
- Adds a function binding to the static context for a single item
This
simply declares the function, and a method object for the function
also must be bound to the dynamic context at execution time.
- funcName
- Specifies the name of the function (expressed localPart,namespaceURI)
- funcType
- Specifies the return type of the function (expressed localPart,namespaceURI)
- argType
- Specifies the types of the function arguments (expressed localPart,namespaceURI)
and is optional
This option can be used multiple times.
If the value of any option contains a blank space,
enclose it in quotation marks.
This option can be used multiple
times.
For example:
-func name=getId,http://example.org type=integer,http://www.w3.org/2001/XMLSchema argtype=string,http://www.w3.org/2001/XMLSchema
- -var name=varName type=varType
- Adds a variable binding to the static context for a single item
This
simply declares the variable, and a value also must be bound to the
XDynamicContext at execution time.
- varName
- Specifies the name of the variable (expressed localPart[, namespaceURI])
If
the variable is in no namespace, the namespace URI should be omitted.
Localpart
is a required value.
- varType
- Specifies the type of the variable (expressed localPart,namespaceURI)
If the value of any option contains a blank
space, enclose it in quotation marks.
This option can be used
multiple times.
For example:
-var name=la,"http://www.ibm.com/Los Angeles" type=boolean,http://www.w3.org/2001/XMLSchema
- -baseURI URI
- Specifies the base URI of the containing element
- -dnet URI
- Specifies a default namespace URI for element and type names
The
namespace URI, if present, is used for any unprefixed QName appearing
in a position where an element or type name is expected.
- -dnf URI
- Specifies a default namespace URI for function names
The namespace
URI, if present, is used for any unprefixed QName appearing in a position
where a function name is expected.
- -imm int
- Sets the integer math mode, which is a constant representing the
level of precision required and whether overflow detection is required
when working with xs:integer values
Valid values include:
- 1
- Values need only support the minimum precision required for a
minimally conforming processor (18 digits).
- 2
- Values should support an arbitrary number of digits of precision;
no overflow should occur.
- 3
- Values need only support the minimum precision required for a
minimally conforming processor (18 digits); but any overflow condition
should be detected and error FOAR0002 should be raised.
- -v
- Prints the version of the compiler
- -h
- Prints the usage statement
- xpathfile
- Full path to a file containing an XPath expression to be compiled
- -i
- Forces the compiler to read the XPath expression from standard
in
The following is a basic example
of compiling an XPath expression using the CompileXPath tool:
- Compile an XQuery expression
- Location
- The product includes the following script that sets up the environment
and invokes the tool.
- Syntax
- Parameters
- -out output
- Uses the name output as the base name for the
generated classes
By default, the base name is XQueryModule.
This
option is ignored if compiling multiple expressions.
- -dir directory
- Specifies a destination directory for the generated classes
The
default is the current working directory.
- -pkg package
- Specifies a package name prefix for all generated classes
The
default is the Java default
package.
- -func name=funcName type=funcType argtype=argType
- Adds a function binding to the static context for a single item
This
simply declares the function, and a method object for the function
also must be bound to the dynamic context at execution time.
- funcName
- Specifies the name of the function (expressed localPart,namespaceURI)
- funcType
- Specifies the return type of the function (expressed localPart,namespaceURI)
- argType
- Specifies the types of the function arguments (expressed localPart,namespaceURI)
and is optional
This option can be used multiple times.
If the value of any option contains a blank space,
enclose it in quotation marks.
This option can be used multiple
times.
For example:
-func name=getId,http://example.org type=integer,http://www.w3.org/2001/XMLSchema argtype=string,http://www.w3.org/2001/XMLSchema
- -baseURI URI
- Specifies the base URI of the containing element
- -dnet URI
- Specifies a default namespace URI for element and type names
The
namespace URI, if present, is used for any unprefixed QName appearing
in a position where an element or type name is expected.
- -dnf URI
- Specifies a default namespace URI for function names
The namespace
URI, if present, is used for any unprefixed QName appearing in a position
where a function name is expected.
- -imm int
- Sets the integer math mode, which is a constant representing the
level of precision required and whether overflow detection is required
when working with xs:integer values
Valid values include:
- 1
- Values need only support the minimum precision required for a
minimally conforming processor (18 digits).
- 2
- Values should support an arbitrary number of digits of precision;
no overflow should occur.
- 3
- Values need only support the minimum precision required for a
minimally conforming processor (18 digits); but any overflow condition
should be detected and error FOAR0002 should be raised.
- -bsp int
- Specifies the boundary space policy
Valid values include:
- 1
- Preserve white spaces
- 2
- Strip white spaces
This is the default value.
- -csm int
- Specifies the construction mode
Valid values include:
- 1
- Preserve
The type of a constructed element node is xs:anyType,
and all attribute and element nodes copied during node construction
retain their original types.
This is the default value.
- 2
- Strip
The type of a constructed element node is xs:untyped,
all element nodes copied during node construction receive the type
xs:untyped, and all attribute nodes copied during node construction
receive the type xs:untypedAtomic.
- -cnmi int
- Specifies the inherit part of the copy-namespaces
Valid values
include:
- 1
- Inherit
Inherit mode should be used in namespace binding assignment
when an existing element node is copied by an element constructor.
This
is the default value.
- 2
- No inherit
No-inherit mode should be used in namespace binding
assignment when an existing element node is copied by an element constructor.
- -cnmp int
- Specifies the preserve part of the copy-namespaces
Valid values
include:
- 1
- Preserve
Preserve mode should be used in namespace binding assignment
when an existing element node is copied by an element constructor.
This
is the default value.
- 2
- No preserve
No-preserve mode should be used in namespace binding
assignment when an existing element node is copied by an element constructor.
- -eso int
- Specifies the empty sequence order
Valid values include:
- 1
- Greatest
- 2
- Least
This is the default value.
- -ordm int
- Specifies the ordering mode
Valid values include:
- 1
- Ordered results are to be returned by certain path expressions,
union, intersect, and except expressions, as well as FLWOR expressions
that have no order by clause
This is the default value.
- 2
- Unordered results are to be returned by certain path expressions,
union, intersect, and except expressions, as well as FLWOR expressions
that have no order by clause
- -v
- Prints the version of the compiler
- -h
- Prints the usage statement
- xqueryfile
- Full path to a file containing an XQuery expression to be compiled
- -i
- Forces the compiler to read the stylesheet from standard in
The following is a basic example
of compiling an XQuery expression using the CompileXQuery tool: