NiceXSL logo Contents Download Update-Site NiceXSL logo

NiceXML Syntax

The nicer language for XSLT constructs is layered upon a nicer language for XML constructs. The NiceXML syntax may be used to incorporate literal XML text within stylesheets or to express XSLT constructs for which NIceXSL support proves inadequate.


<e1 a1="a1">
  <e2 a2="a2">
    <e3 a3="a3"/>

can be expressed as

<e1 a1="a1"
  <e2 a2="a2"
    <e3 a3="a3">

NiceXML requires rather than prohibits lexical construct nesting and makes the repetitive end-of construct keywords optional. A NiceXML construct that starts with < therefore ends at the matching >. NiceXML allows XML tag names to be re-specified at the end of a construct, and this may be used for documentation or diagnosis of deep hierarchies.

must therefore be rewritten in NiceXML, to use hierarchical nesting as
  <a <b>>.

Use of additional construct closers as in
  <a <b/>/>
  <a <b /b>/a>
is optional.

Text nodes must be written in quotes, so the XML
  <a>some text</a>
must be written as
  <a "some text">
  <a 'some text'>

The attribute name in an attribute node may be prefixed by an @, so the XML
  <a key="word"/>
may be written as
  <a @key="word">.
The extra @ is necessary only when the subsequent attribute name corresponds to a NiceXSL construct keyword.
  <a @apply-templates="yes">

???Parentheses, rather than quotes should be used when the argument is an XPath expression: <a @key=(word)> .

The standard XML
   &amp; &gt; &lt; &quot; &# decimal; and   &#xhexadecimal;
policies for character references in strings are supported; A new line should therefore be entered as &#xA; (not as /n).

A group of child nodes may be enclosed in braces to assist structuring:
  <a { @b = "c" <d> } >

Standard multi-line XML comments can be provided using the standard   <!-- introducer and --> terminator.

Alternatively end-of-line comments can be placed at the end of a line following a --. End of line comments areremoved during translation to XSL.

Syntax Summary

The NiceXML form of XML syntax is summarised by way of examples in the following tables.

  • Typewriter font denotes exact text.
  • Italic font denotes a parametric value.
  • ... denotes an incomplete example.
  • + denotes one or more repetitions of the preceding construct.
  • * denotes zero or more repetitions of the preceding construct
  • Preferred NiceXSL syntax XML equivalent
    -- end-of-line-comment  
    <!-- multi-line-comment --> <!-- multi-line-comment -->
    <key attr* node*> <key attr*> node* </key>
    <key attr*> <key attr*/>
    <? key processing-instruction ?/> <? key processing-instruction ?/>
    @attribute-name=(xpath-expression) attribute-name="xpath-expression"
    "multi-line-text" multi-line-text