Endnotes

This xslt transforms  elements for display in xhtml. It places a numbered marker at the insertion point and reproduces the note content in a separate section at the end of the document. Links between the insertion marker and note are automatically generated.

Input TEI
...Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Suspendisse faucibus. Nulla a tortor id pede aliquam venenatis. Donec eget lectus. Fusce hendrerit, quam ac nonummy rutrum, turpis odio ultrices tortor...

XHTML 1.0 (Strict)
At the insertion point:

...Lorem ipsum dolor sit amet, consectetuer adipiscing elit.  [ 1]  Fusce hendrerit, quam ac nonummy rutrum, turpis odio ultrices tortor...

Elsewhere in the document

Notes:  [ 1] . Suspendisse faucibus. Nulla a tortor id pede aliquam venenatis. Donec eget lectus.

XSLT
The same stylesheet works in xslt 1.0 and xslt 2.0.

Create note section
The following template should be called (using