Subject: Re: trying to create a node-set of attribute nodes
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Mon, 10 Mar 2003 17:22:11 +0000
|
Hi Ankit,
> I too have a similar problem :
>
> <xsl:template match="Annotation/@type[. = 'interesting']">
> <DIV style="background:Yellow">
> <font face="Arial" color="RED">
> <xsl:apply-imports/>
> </font>
> </DIV>
> </xsl:template>
>
> I would like to apply tempplate to all <Annotation> tags which have
> their "type" attribute value="interesting".
The above template *matches* 'type' attributes whose value is
'interesting'. If you want to apply templates to such attributes, then
you need to use something like:
<xsl:apply-templates select="@type[. = 'interesting']" />
in a template where the context node is an <Annotation> element. Note
that unlike elements, attributes do not get templates applied to them
unless you explicitly tell the processor to do so.
Perhaps you actually want to match <Annotation> elements whose type
attribute is 'interesting'? In that case, use:
<xsl:template match="Annotation[@type = 'interesting']">
...
</xsl:template>
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|