[xsl] First occurrence of glossary term in whole document

Subject: [xsl] First occurrence of glossary term in whole document
From: "Marroc" <marrocdanderfluff@xxxxxxxxxxx>
Date: Wed, 30 Jul 2008 15:27:39 +0100
Hi,

I've done well. I've now created the recursive template that replaces
glossary terms throughout the <p> tags with cross-references. That is
fine... but... I only want to process the first occurrence of each glossary
term in the document and at the moment, because the XSLT is declarative, I
can't keep track of whether a particular term has been used. My XSL goes
like this:

	root template launch named template with parameter containing whole
document

	named template (recurses document and glossary list)
		stop condition: when glossary list is empty/exhausted return
whole document
		otherwise process first item in glossary list and update
document (apply templates)
			remove first item from glossary list and pass back
list and updated document to (this) named template

	template to process p/text() for glossary term

	template identity transform for rest of document nodes and
attributes

Is that enough for you to go on or should I post xsl? I suspect that I
require a rewrite with this requirement deciding the fundamental structure
of the XSL but can't think how to get started.

Thanks again,
Richard

Current Thread