Chapter 1Invisible XML in Saxon

The CoffeeSacks extension functions allow a stylesheet to load an Invisible XML grammar and process an input against it.

The class org.nineml.coffeesacks.RegisterCoffeeSacks is suitable for registering the extension functions to a Saxon HE processor.

All of the functions are in the namespace which is taken to be bound to the cs: namespace prefix in this document.

Given an Invisible XML grammar for dates in date.ixml:

date: s?, day, -s, month, (-s, year)? .
-s: -" "+ .
day: digit, digit? .
-digit: "0"; "1"; "2"; "3"; "4"; "5"; "6"; "7"; "8"; "9".
month: "January"; "February"; "March"; "April";
       "May"; "June"; "July"; "August";
       "September"; "October"; "November"; "December".
year: (digit, digit)?, digit, digit .

A stylesheet like the following will parse a string against that grammar and return the result:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl=""

<xsl:output method="xml" encoding="utf-8" indent="yes"/>

<xsl:template match="/">
  <xsl:variable name="parser" select="cs:load-grammar('date.ixml')"/>
    <xsl:sequence select="$parser('15 February 2022')"/>