Extension Instructions

In XCST there are basically three categories of elements: XCST elements, which represent program structure and instructions; Literal result elements, which represent the data that is the output of an XCST program; and extension instructions, which represent additional instructions made available by an XCST processor or by a third party.

An extension instruction is an element, within a sequence constructor, in a namespace designated as an extension namespace. To designate a namespace as an extension namespace use the [c:]extension-element-prefixes standard attribute, e.g.:

<?xml version="1.0" encoding="utf-8"?>
<c:module version='1.0' language='C#'
   xmlns:c='http://maxtoroq.github.io/XCST'
   xmlns:a='http://maxtoroq.github.io/XCST/application'
   extension-element-prefixes='a'>
   ...
</c:module>

If you forget to designate a namespace as an extension namespace then the elements will be treated as literal result elements.

It is a compilation error to designate a reserved namespace as an extension namespace, except for extensions made available by this project.

Fallback

If you are not sure a particular extension instruction will be available you can use the c:fallback instruction as child of the extension instruction, e.g.:

<c:template name='c:initial-template' extension-element-prefixes='eg' xmlns:eg='http://example.com/ns/foo'>
   <eg:foo>
      <c:fallback>
         <c:message>eg:foo not available.</c:message>
         <c:call-template name='fallback-foo'/>
      </c:fallback>
   </eg:foo>
</c:template>