OScript API/Built-in Package Index

Class: XSLProcessor

The XSLProcessor class provides an API to perform XSL transformations on XML documents.

Class Attributes

Recoverable error.

Error that will stop processing.

XML output style without the XML declaration.

Output style - It will guess either XML, Fragment, HTML, or Text

HTML output style.

Informational status or message.

Plain text output style.

Warning message.

XML output style.

Class Methods

New( )

Create a new XSLProcessor instance.

Instance Methods

SetEntityResolver( Dynamic objref, Dynamic entryName )

Sets the object reference and entry point name for the resolve entity reference callback.

SetInput( Dynamic xmlInput, [String relativeUrl] )

Sets the input file or input DOMNode.

SetOutput( Dynamic xmlOutput, [Integer writeStyle] )

Sets the output file or output DOMNode.

SetParameter( String name, String value )

Sets the value of a parameter that will be referenced by the XSL stylesheet.

SetStylesheet( Dynamic xslInput, [String relativeUrl] )

Sets the XSL stylesheet that will be used to perform the transformation.

Perform the XSL transformation.

Class Attributes

Integer Error

Recoverable error.

Integer FatalError

Error that will stop processing.

Integer Fragment

XML output style without the XML declaration.

Integer Guess

Output style - It will guess either XML, Fragment, HTML, or Text

Integer HTML

HTML output style.

Integer Message

Informational status or message.

Integer Text

Plain text output style.

Integer Warning

Warning message.

Integer XML

XML output style.

Class Methods

New

XSLProcessor New()

Create a new XSLProcessor instance.

Returns:

A new XSLProcessor.

Instance Methods

SetEntityResolver

Void SetEntityResolver( Dynamic objref,
                        Dynamic entryName )

Sets the object reference and entry point name for the resolve entity callback.

The return value is a string to the resolved entity. An undefined return value indicates to the parser that it should use its default internal entity resolution.

Parameters

objref

The reference to the object that has the script to be used in the callback.

entryName

The script name of the callback that will be executed on callback.

Returns:

SetInput

Boolean SetInput( Dynamic xmlInput,
                  [String relativeUrl] )

Sets the input file or input DOMNode. When the xmlInput is a DOMNode, the relativeUrl is used to resolve any relative URIs found and for error reporting.

Parameters

xmlInput

The name of the file or DOMNode.

relativeUrl

Used for resolving relative URIs and for error reporting.

Returns:

True if the method succeeds, false otherwise.

SetOutput

Boolean SetOutput( Dynamic xmlOutput,
                   [Integer writeStyle] )

Sets the output file or output DOMNode. When the xmlOutput is a file, the writeStyle parameter can be specified to determine the type of output desired (XML, XML Fragment, HTML, or Text).

Parameters

xmlOutput

The name of a file or a DOMNode.

writeStyle

The style of output desired.

Returns:

True if the method succeeds, false otherwise.

SetParameter

Void SetParameter( String name,
                   String value )

Sets the value of a parameter that will be referenced by the XSL stylesheet.

Parameters

name

The name of an XSL parameter to set.

value

The value that the parameter should be set to.

Returns:

SetStylesheet

Boolean SetStylesheet( Dynamic xslInput,
                       [String relativeUrl] )

Sets the XSL stylesheet that will be used to perform the transformation.

Parameters

xslInput

The name of a file or DOMNode.

relativeUrl

Used for resolving relative URIs and for error reporting.

Returns:

True if the method succeeds, false otherwise.

Transform

Assoc Transform()

Perform the XSL transformation.

Returns:

An Assoc that contains:

Boolean OK Status of the parse.
RecArray Error Errors that occurred during parsing.

If the status of the parse is false, then the error RecArray contains:

String ErrType The type of error: warning, error or fatal.
String ErrMsg XSL Processor generated error message.

 Copyright © 2021 OpenText Corporation. All rights reserved.