[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Matching Attributes with @
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|