swirl
Guide to OmniMark 8   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
      Other Library Functions  
function  

xslt.writer

 
 

Library: XSLT support (OMXSLT)
Import: omxslt.xmd
Return type: String sink

Returns: An OmniMark output object to the XSLT processor


Declaration

export external string sink function writer 
              with value     stylesheet stylesheet
        parameters read-only stream     parameters optional
              into value     output    xml-output

Argument definitions

stylesheet
is the XSLT stylesheet that will be applied to the input data,
parameters
is a shelf of parameters required by the stylesheet, and
xml-output
is a destination to which the XSLT processor will write its data.


Purpose

Use writer to apply an XSLT stylesheet to a well-formed XML instance that is generated by the execution of your OmniMark program. The result of the transformation is written to xml-output, from where further processing can be performed.

Example

An XSLT stylesheet stored in a file stylesheet1.xsl can be applied to a well-formed XML instance stored in file input1.xml using the following program. Before passing the data through the XSLT processor, the program uses pattern-matching to uppercase all element names in the input data. It is the output of the pattern matching engine is fed to the XSLT processor.

          import "omxslt.xmd" prefixed by xslt.
  
          process
             local xslt.stylesheet stylesheet initial { xslt.compile file "stylesheet1.xsl" }
  
             using output as xslt.writer with stylesheet into file "input1.out"
                submit file "input1.xml"
  
          find ("</" | "<")  => start-marker 
                letter+      => element-name
                ("/>" | ">") => end-marker
             output start-marker || "ug" % element-name || end-marker
        

If the stylesheet is being applied only once, there is no need to declare a shelf of type stylesheet. OmniMark can convert a stream representation of the stylesheet into the appropriate format. The above example can then be modified to read

         using output as xslt.writer with file "stylesheet1.xsl" into file "input1.out"
        

        Other Library Functions
   xslt.compile
   xslt.omxslt-version
   xslt.reader
   xslt.stylesheet
   xslt.writer
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 8.2.0 Documentation Generated: March 13, 2008 at 3:27:39 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2008.