Re: [xsl] Attribute List

Subject: Re: [xsl] Attribute List
From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx>
Date: Fri, 25 Mar 2005 08:21:07 -0800 (PST)
Hi Carmelo,

I tried this example..

XML file -
  <term a="1" b="2">
    <term c="3" d="4">
      <term e="5" f="6">

XSL file -
<?xml version="1.0"?> 
 <xsl:output method="text" /> 
 <xsl:template match="/root">
   <xsl:variable name = "allAttributes" select =
   <xsl:for-each select="$allAttributes">
     <xsl:value-of select="name()" /> , <xsl:value-of
select="." /><xsl:text>&#xa;</xsl:text>

The output produced is -
a , 1
b , 2
c , 3
d , 4
e , 5
f , 6

So descendant::term/@*  "does lists" all attributes of
all descendant "term" elements.

If you can show rest of your code, and tell the exact
problem you are solving(with input XML and the desired
output), someone might suggest the right approach.


--- Carmelo Montanez <carmelo@xxxxxxxx> wrote:
> All:
> I would think that this statement will select all of
> the attributes of the
> descendant "term" elements of the context node.
> <xsl:variable name = "allAttributes" select =
> "descendant::term/@*"/>
> Instead is only selecting the attribute of the FIRST
> "term" node.  What I 
> am missing?.  I just want a list of all Attributes
> of all descendant "term"
> elements.
> Thanks
> Carmelo

Do you Yahoo!? 
Make Yahoo! your home page

Current Thread