xsl-list
[Top] [All Lists]

[xsl] First occurrence of glossary term in whole document

2008-07-30 07:28:12
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



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--