RE: [xsl] First occurrence of glossary term in whole document

Subject: RE: [xsl] First occurrence of glossary term in whole document
From: "Marroc" <marrocdanderfluff@xxxxxxxxxxx>
Date: Wed, 30 Jul 2008 19:06:40 +0100
Ooops, that isn't true. I can't pass the result document down because the
variable isn't updated until after the full file is processed thereby
allowing multiple references to creep in.

I'll have another go tomorrow using Liam's suggestion. Thanks. R 

-----Original Message-----
From: Marroc [mailto:marrocdanderfluff@xxxxxxxxxxx] 
Sent: 30 July 2008 18:43
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] First occurrence of glossary term in whole document

Thanks Liam. Thanks for taking the time.

OK. So I've worked out that if I pass the current results document variable
to the transform and check the already implemented xrefs to see if one
already exists with this text then I can be sure not to repeat.

    <p>This line is included to mention <xref outputclass="glossaryTerm" 
	href="Glossary Terms/ADSL.dita">ADSL</xref> so that it can be 
	converted to a glossary cross-reference.</p>

Unfortunately, I still struggle with these node tests and so, where
$currentterm='ADSL':

	test="exists($resultdoc//xref/text()[$currentterm])"

and all similar combinations don't appear to evaluate true(). Is it just me
who seems to come to these tests fresh every time? What is it that I don't
'get'. Is there a common miscomprehension that I'm tripping over or can I
blame the tools? ;-)

Thanks,
Richard 

-----Original Message-----
From: Liam Quin [mailto:liam@xxxxxx]
Sent: 30 July 2008 17:57
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] First occurrence of glossary term in whole document

On Wed, Jul 30, 2008 at 03:27:39PM +0100, Marroc wrote:
> I only want to process the first occurrence of each glossary term in 
> the document

If they are marked up, you can use a reverse axis to find if there are
earlier ones (if that's too slow you can do something cunning with key() and
position()).

If these are the terms you're replacing, and are not marked up, it might be
easiest to run XSLT twice, first to mark up the terms and then to process
them (or remove the markup from the ones you don't want).

I've seen conversions with as many as 30 such steps in them -- it can be
much easier to manage than doing everything in one pass.

Liam

--
Liam Quin, W3C XML Activity Lead, http://www.w3.org/People/Quin/
http://www.holoweb.net/~liam/ * http://www.fromoldbooks.org/

Current Thread