[xsl] How to do an 'existence' test in XSL?

Subject: [xsl] How to do an 'existence' test in XSL?
From: ben@xxxxxxxxxxxxx
Date: Wed, 22 Dec 2004 14:33:06 +0000
I'm having great difficulty understanding how/if XSL provides the tool to satisfy the following simple requirement. 

Lets say I have some simple xml like :

<gui type="alertBox">...</gui>
<gui type="tooltip">...</gui>
<gui type="help">...</gui>
<gui type="tooltip">...</gui>
<gui type="alertBox">...</gui>
<gui type="tooltip">...</gui>
<gui type="help">...</gui>

To simplify things... imagine transforming this document in such a way that we have something like :

<alertBox/>
<tooltip/>
<help/>

i.e. I would like the XSL to result in one output per gui type.

So there is the problem... how on earth do I process the xml such that it results in an output per +type+ rather than for each instance (is that explained well enough?)... i.e. it's easy to match on the attributes but each match produces output so I would get :

<alertBox/><alertBox/>
<tooltip/><tooltip/><tooltip/>
<help/><help/>

Can anyone offer advice on the way in which I ought to approach this problem?

Kindest regards,

Ben

Current Thread