USXSL internal component

Previous Next

The USXSL internal component lets you use XSLT to transform XML documents and extract data from an XML document. The component makes it easy to embed XSLT transformations in a USoft application. You can use it to:

Apply an XSL transformation to an XML document.

Retrieve a value from an XML document.

Retrieve a complete node from an XML document.

Temporarily store an XML or XSL document in memory.

Mix USoft application data into an XSLT transformation.

 

For USoft XML formats, see XML.

Encoding

A different encoding is produced depending on whether the output is internal or external.

The USXSL component produces UTF-16 output encoding internally, ie., as long as the output is not written to a file on the file system or passed to a third party by way of a webservice call. This is because with UTF-16 we can easily exchange Unicode characters with controls and other Windows-related interfaces. UTF-16 is also the encoding recommended by Microsoft.

Correspondingly, in this case, the USXSL component produces the attribute encoding="UTF-16" in the XML declaration at the top of the output document. You cannot change this behaviour. It applies regardless of what is the value of the encoding attribute of the <xsl:output> instruction in the XSL stylesheet (if such an attribute is present).

By default, the USXSL component produces UTF-8 output encoding externally, ie., when the result is written to a file on the file system, as is the case when you call USXSL.Apply2File, or is passed to a third party by way of a webservice call. This is because UTF-8 is a common default in these cases. You can obtain a different external output encoding by specifying it as the encoding attribute of the <xsl:output> instruction in the XSL stylesheet, for example:

<xsl:output encoding="UTF-16"/>

or

<xsl:output encoding="ISO-8859-1"/>

 

Methods

The USXSL internal component has the following methods:

USXSL.Apply

Applies an XSLT transformation to an XML document.

USXSL.Apply2File

Applies an XSLT transformation to an XML document, then writes the result to a file on the file system.

USXSL.Node

Retrieves a node from an XML document by an XPath expression.

USXSL.SetGlobalXsl

Associates a global alias with a parsed XSL document that is held in-memory

USXSL.SetXml

Associates an alias with a parsed XML document that is held in-memory

USXSL.SetXsl

Associates an alias with a parsed XSL document that is held in-memory

USXSL.Value

Retrieves a value from an XML document by evaluating an XPath expression.