www.altova.com
Previous  Top  Next

General Information


The Altova XSLT 2.0 Engine conforms to the World Wide Web Consortium's (W3C's)  XSLT 2.0 Recommendation of 23 January 2007. Note the following general information about the engine.

 

 

Backwards Compatibility

The Altova XSLT 2.0 Engine is backwards compatible. The only time the backwards compatibility of the XSLT 2.0 Engine comes into play is when using the XSLT 2.0 Engine of Altova XML to process an XSLT 1.0 stylesheet. Note that there could be differences in the outputs produced by the XSLT 1.0 Engine and the backwards-compatible XSLT 2.0 Engine.

 

In all other Altova products, the backwards-compatibility issue never arises. This is because these products automatically select the appropriate  engine for the transformation. For example, consider that in XMLSpy you specify that a certain XML document be processed with an XSLT 1.0 stylesheet. When the transformation command is invoked, XMLSpy automatically selects the XSLT 1.0 Engine of XMLSpy to carry out the transformation.

 

Note:The stylesheet version is specified in the version attribute of the stylesheet or transform element of the stylesheet.

 

 

Namespaces

Your XSLT 2.0 stylesheet should declare the following namespaces in order for you to be able to use the type constructors and functions available in XSLT 2.0. The prefixes given below are conventionally used; you could use alternative prefixes if you wish.

 

Namespace Name

Prefix

Namespace URI

XML Schema types

xs:

http://www.w3.org/2001/XMLSchema

XPath 2.0 functions

fn:

http://www.w3.org/2005/xpath-functions

 

Typically, these namespaces will be declared on the xsl:stylesheet or xsl:transform element, as shown in the following listing:

 

<xsl:stylesheet version="2.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

xmlns:xs="http://www.w3.org/2001/XMLSchema"

xmlns:fn="http://www.w3.org/2005/xpath-functions"

...

</xsl:stylesheet>

 

The following points should be noted:

 

The Altova XSLT 2.0 Engine uses the XPath 2.0 and XQuery 1.0 Functions namespace (listed in the table above) as its default functions namespace. So you can use XPath 2.0 and XSLT 2.0 functions in your stylesheet without any prefix. If you declare the XPath 2.0 Functions namespace in your stylesheet with a prefix, then you can additionally use the prefix assigned in the declaration.
When using type constructors and types from the XML Schema namespace, the prefix used in the namespace declaration must be used when calling the type constructor (for example, xs:date).
With the CRs of 23 January 2007, the untypedAtomic and duration datatypes (dayTimeDuration and yearMonthDuration), which were formerly in the XPath Datatypes namespace (typically prefixed xdt:) have been moved to the XML Schema namespace.
Some XPath 2.0 functions have the same name as XML Schema datatypes. For example, for the XPath functions fn:string and  fn:boolean there exist XML Schema datatypes with the same local names: xs:string and xs:boolean. So if you were to use the XPath expression string('Hello'), the expression evaluates as fn:string('Hello')—not as xs:string('Hello').

 

 

Schema-awareness

The Altova XSLT 2.0 Engine is schema-aware.

 

 

Whitespace in XML document

By default, the Altova XSLT 2.0 Engine strips all boundary whitespace from boundary-whitespace-only nodes in the source XML document. The removal of this whitespace affects the values that the fn:position(), fn:last(), fn:count(), and fn:deep-equal() functions return. For more details, see Whitespace-only Nodes in XML Document in the XPath 2.0 and XQuery 1.0 Functions section.

 

Note: If a boundary-whitespace-only text node is required in the output, then insert the required whitespace within one of the two adjoining child elements. For example, the XML fragment:

 

<para>This is <b>bold</b> <i>italic</>.</para>

 

when processed with the XSLT template

 

<xsl:template match="para">

       <xsl:apply-templates/>

</xsl:template>

 

will produce:

 

This is bolditalic.

 

To get a space between bold and italic in the output, insert a space character within either the <b> or <i> elements in the XML source. For example:

 

<para>This is <b>bold</b> <i> italic</>.</para> or

<para>This is <b>bold&#x20;</b> <i>italic</>.</para> or

<para>This is <b>bold</b><i>&#x20;italic</>.</para>

 

When such an XML fragment is processed with the same XSLT template given above, it will produce:

 

This is bold italic.

 

 

XSLT 2.0 elements and functions

Limitations and implementation-specific behavior of XSLT 2.0 elements and functions are listed in the section XSLT 2.0 Elements and Functions.

 

 

XPath 2.0 functions

Implementation-specific behavior of XPath 2.0 functions is listed in the section XPath 2.0 and XQuery 1.0 Functions.

 


Previous  Top  Next

© 2008 Altova