RE: Matching Attributes with @

Subject: RE: Matching Attributes with @
From: Linda van den Brink <lvdbrink@xxxxxxx>
Date: Fri, 26 May 2000 09:22:09 +0200
>      I thought that apply-templates was only applied to 
> elements, so how is apply-templates applied to attributes ?? 
> Or does this mean that apply-templates is applied to all 
> child elements of ATOM that have an attribute called UNITS ??
> If my last assumption is correct, then further to the last 
> paragraph from the XML Bible extract above, does
> <xsl:apply-templates select="BOILING_POINT/@*"/> cause 
> apply-templates to be applied to all BOILING_POINT children 
> that have at least one attribute ??

Templates can be applied to all types of nodes (for examples see section 5.2
of the XSLT spec) such as element nodes, text nodes, and also attribute
nodes. So your assumption was incorrect. 

<xsl:apply-templates select="BOILING_POINT/@*"/> applies templates for all
attributes of the BOILING_POINT element. TO cause templates to be applied to
all children of BOILING_POINT elements that have at least one attribute, you
would do

<xsl:apply-templates select="BOILING_POINT/*[@*]"/>

Linda


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread