RE: Matching Attributes with @

Subject: RE: Matching Attributes with @
From: John Robert Gardner <jrgardn@xxxxxxxxx>
Date: Fri, 26 May 2000 12:39:55 -0400 (EDT)
On Fri, 26 May 2000, Paulo Gaspar wrote:

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

I remember a comment some time ago on this . . . that attributes are
descendents . . . wouldn't they be children? -- of their containing
element node, or context element node.  So the element can have attribute
children.  But, that an attribute cannot reference its own element context
node as a "parent."  This would be consistent with the post elsewhere
today on this matching @ thread, that matching an @ does not match the
element node that contains it.  To do so one would have to do "*[@foo]",
correct?  So @ are children, but those children do not have parents?  



John Robert Gardner, Ph.D.
XML Engineer
Emory University
"There is a difference between knowing The Path, and walking the Path."
					-Lawrence Fishburn/Morpheus

> 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:
>  XSL-List info and archive:

 XSL-List info and archive:

Current Thread