Compatible Stylesheets with xsl:fallback

The following code is an example of how to use the xsl:fallback element to achieve full compatibility between XSLT different versions.

Imagine that some future 5.0 version of XSLT implements an element. Processors using earlier versions of XSLT wouldn’t understand that element, so you can include an element to enable the processor to continue, using elements it understands from an earlier version of XSLT.

         XSLT 5.0 - OK - XSLT 5.0                                    XSLT 1.0 - OK - XSLT 1.0                         				          ...

A processor using XSLT 1.0/2.0 will fail to recognize the element, but because it contains an element the older processor will evaluate the test in the element instead of throwing an error.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: