Re: [xsl] Reading Attributes in XSL

Subject: Re: [xsl] Reading Attributes in XSL
From: Jon Gorman <jonathan.gorman@xxxxxxxxx>
Date: Tue, 15 Nov 2005 10:34:47 -0600
On 11/15/05, pankaj.ahuja@xxxxxxxxxxxx <pankaj.ahuja@xxxxxxxxxxxx> wrote:
> Hi:
>
> I am trying to read attributes of current node such that I read the first
> Attribute and then read all attributes of child elements (as many child
> elements there are) and then back to reading the second attribute of the
> parent node.

Considering attributes are unordered in XML this could be risky.  Most
XML parsers I believe will return them in document order but not
necessarily all.  A better way might be to take the name of the
attribute and match on that.

Also, do you really mean children or descendants?  If just children
you can get away with a for-each loop, otherwise you'll either need
some sort of grouping approach or recursive templates.


Jon Gorman

Current Thread