Matching Attributes with @

Subject: Matching Attributes with @
From: Paul_Martin@xxxxxxxxxxxxxx
Date: Fri, 26 May 2000 15:41:29 +1000
XML Bible says the following in the subsection on "Matching Attributes with @" :-

"You must remember that what's being matched is the attribute node, not the element that contains it. It's a very common mistake to implicitly confuse the attribute node with the element node that contains it. For example, consider this rule, which attempts to apply templates to all child elements that have UNITS attributes:

<xsl:template match="ATOM">
  <xsl:apply-templates select="@UNITS"/>
</xsl:template>

What it actually does is apply templates to the UNITS attributes of ATOM elements.

You can also use the * to select all attributes of an element, for example BOILING_POINT/@* to select all attributes of BOILING_POINT elements."


     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 ??

Thanks very much in advance.


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


Current Thread