2. cs:grammar

Before it can be used, a grammar must be loaded. You can load Invisible XML grammars in either the text or XML syntax. You can also load grammars in the CoffeeGrinder compiled format.

$hrefxs:stringThe grammar location
cs:grammar($href, $options)node()
$hrefxs:stringThe grammar location
$optionsmap(xs:string, xs:string)Grammar options

The following options are recognized:


If unspecified or specified with the value “true” or “yes”, the grammar will be cached. If any other value is specified, the grammar will not be cached.

Caching the grammar saves the mapping between the URI and the parsed XML node.


Identifies the type of grammar to parse:


For Invisible XML in text format.

xml or vxml

For Invisible XML in XML format.

cxml or compiled

For a grammar in the compiled CoffeeGrinder format.

It is an error to specify any other value.

This is not usually necessary. The grammar compiler will “sniff” the first 4,095 bytes of the file to identify the grammar which is usually sufficient.


Specifies the encoding to use for Invisible XML grammars in the text format.