Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

SLAX Elements as Function Arguments

Starting with SLAX version 1.2, you can use SLAX elements directly as arguments for both functions and templates. Function arguments can either be a single element or a block of SLAX code, placed inside braces as shown in the following example:

For templates, you still need to include the argument name, but the value can be inline. For example:

The Main Template

Starting with SLAX version 1.2, the main template is introduced in SLAX. The main template enables you to process the input XML document and provide the top-level element for the output hierarchy. The main template is equivalent to using match / but slightly more convenient.

You can use the main statement to match the top of the input data hierarchy and create the top-level tag of the output hierarchy. You can use the statement in two forms: with or without the output tag. When you omit the output element, main is just followed by a block of statements within a set of braces, as shown in the following example:

The main template can also be used with a top-level output element following the main token, as shown in the following example:

Both of the preceding examples are equivalent to the following XSLT version: