[xsl] check for ancestors attribute

Subject: [xsl] check for ancestors attribute
From: "Robert Soesemann" <rsoesemann@xxxxxxxxxxx>
Date: Tue, 8 Feb 2005 12:11:34 +0100
How do I need to extend this template to match not only <foo name="bar"> but
further restrict my template to those <foo>s that have an ancestor with
attribute type="general".

<xsl:template match="foo[@name='bar']">

</xsl:template>

I only want to match e.g.
<...>
	...
	<...type="general">
	...
		<foo name="bar">		<<--- match this
		..
		</foo>
	...
	</...>
	...
</...>

It seem to be not OK to write:

<xsl:template match="foo[@name='bar' and ancestor::@type='general']">

</xsl:template>

Can you help?

--
Robert Svsemann
Associate, Technology | Sapient

Kellerstr. 27
81667 M|nchen, Deutschland
Tel.: +49 89/552 987-143
Mobil: +49 162/2773-143
Fax: +49 89/552 987-100
Email: rsoesemann@xxxxxxxxxxx

Current Thread