|
|||||
xslt.stylesheet
|
The stylesheet OMX component encapsulates an XSLT stylesheet. Once a stylesheet OMX has been created, it can be used to transform input data.
The OmniMark XSLT dynamic link library file (omxslt.dll or
omxslt.so) creates the stylesheet OMX component. The
related OmniMark module file (omxslt.xmd) defines its
interface. Within your program, you can create as many
instances of this type as you require by declaring local and
global shelves of type stylesheet
. To use the stylesheet OMX
component in your program, you must import it into your program using
a statement like this:
import "omxslt.xmd" prefixed by xslt.
(Please see the import
topic for more on importing.)
The prefix can be changed to suit your needs, as per the rules of OmniMark's module syntax.
In practice, it is not necessary to directly manipulate
shelves of type stylesheet
: OmniMark will convert a string
representation of an XSLT stylesheet into the correct
representation when it is required.
Example:
By declaring a shelf of type stylesheet
and using it when
applying a stylesheet to multiple sets of input data, you can
avoid having to recompile the stylesheet for every iteration.
import "omxslt.xmd" prefixed by xslt. process local stream filenames initial { "input1.xml", "input2.xml" } local xslt.stylesheet stylesheet initial { xslt.compile file "stylesheet1.xsl" } repeat over filenames do xml-parse scan xslt.reader with stylesheet into file filenames suppress done again element #implied suppress