Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.Opens in a new tab

For information on migrating to InterSystems IRISOpens in a new tab, see Why Migrate to InterSystems IRIS?

XSLT2.Examples

class XSLT2.Examples extends %Library.RegisteredObject

For these examples, streams are derived from XDATA blocks within this class. In a real-world scenario streams (or files) would come from an external source

Method Inventory

Methods

classmethod Example1()
This demonstrates a transformation by simply sorting the elements within the XML
classmethod Example10(XMLFilePath As %String, XSLFilePath As %String, OutputXMLFilePath As %String)
This demonstrates a transformation without wrapping each XSLT request in connect/disconnect (or start/stop) messages. Note the explicit calls to start/stop the gateway before/after the three requests. The first request sends the original XSL as a file and compiles it. The second request sends the original XML as a file and transforms it using the compiled styleshhet. The third request releases the compiled stylesheet from the gateway.
classmethod Example11(XMLFilePath As %String, XSLFilePath As %String, OutputXMLFilePath As %String)
This demonstrates use of the evaluate cache and pre-population feature. The first transform is done with an empty cache of maximum size 50. Next we dump the cache and check that the size is indeed <=50. Then we use the dump to pre-load the cache for the next transform (of the same file). The second transform is done with a pre-populated cache.
classmethod Example12(XMLFilePath As %String, XSLFilePath As %String, OutputXMLFilePath As %String)
This demonstrates use of the evaluate cache and filter list feature. The first transform is done with an empty cache of maximum size 1000, which is the default. Next we dump the cache and add only a single function call to the filter list. Then we clear the cache and do transform the same file again. The second transform is done with an empty cache and a filter of the single function call that can be included in the cache.
classmethod Example2()
This demonstrates a passing top level parameters to a style sheet
classmethod Example3()
This demonstrates calling cache via the isc:evaluate() function, the title is transformed from a reversed string to the readable representation by calling into cache
classmethod Example4()
Example 4, Transform a stream. For this example, streams are derived from XDATA blocks within this class. In a real-world scenario streams would come from an external source
classmethod Example5()
Example 5, Transform a stream. For this example, streams are derived from XDATA blocks within this class. In a real-world scenario streams would come from an external source. The XSL specification is first compiled and then is used to transform the source. This is useful for when the same stylesheet needs to be applied to many different xml sources as it can result in considerable performance improvements.
classmethod Example6()
Example6, Transform a stream. For this example, streams are derived from XDATA blocks within this class. In a real-world scenario streams would come from an external source. Here we install the default Callback Handler
classmethod Example7(XMLFilePath As %String, XSLFilePath As %String, OutputXMLFilePath As %String)
This demonstrates a transformation using filepaths (strings) to commumicate with the Java gateway. Original XML and XSL is sent to the Java gateway as filepaths. Transformed XML is written to disk in Java and passed back to Cache as a filepath.
classmethod Example8(XMLFilePath As %String, XSLFilePath As %String, OutputXMLFilePath As %String)
This demonstrates a transformation using streams to communicate with the Java gateway. Original XML and XSL is sent to the Java gateway as streams. Transformed XML is passed back to Cache as a stream and written to disk in Cache.
classmethod Example9()
This demonstrates a transformation using strings to communicate with the Java gateway. Original XSL is sent to the Java gateway as a stream. Original XML is sent to the Java gateway (in a separate request) as a string and transformed using the compiled styleshhet. Transformed XML is passed back to Cache as a string and written to the current output device in Cache.

Inherited Members

Inherited Methods

FeedbackOpens in a new tab