RE: Matching Attributes with @

Subject: RE: Matching Attributes with @
From: "Paulo Gaspar" <Paulo.Gaspar@xxxxxxxxxxxx>
Date: Fri, 26 May 2000 13:05:33 +0200
Think of an XML document as a tree of nodes. There is nothing else than
that.

Each element node can have 2 basic types of descendent nodes:
 - Content;
 - Attributes.
Content can contain other element nodes but attributes never have
descendents.

May be this vocabulary is not consistent with the standards but having
this rough generalization in mind helped me a lot to understand how to
work with XSLT.


Have fun,

Paulo


-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxx]On Behalf Of Linda van den Brink
Sent: Friday, May 26, 2000 9:22 AM
To: 'xsl-list@xxxxxxxxxxxxxxxx'
Subject: RE: Matching Attributes with @


>      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


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


Current Thread