[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: looping the attributes

Subject: Re: looping the attributes
From: "Charles Ohana" <cohana@xxxxxxxxxxxxxxx>
Date: Tue, 27 Aug 2002 14:35:14 -0700
Re:  looping the attributes
Thanx Trevor.

----- Original Message ----- 
From: "Trevor Nash" <tcn@xxxxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, August 27, 2002 10:58 AM
Subject: Re:  looping the attributes


> Charles Ohana wrote:
> 
> >Hello,
> >I'm trying to display the whole xml data in a table in a generic way.
> >I don't know the name of the fields, all I know is the name of the node.
> >
> >Here is an example
> ><root>
> >  <line c1="1" c2="2" />
> >  <line x1="A" x2="B" />
> ></root>
> >
> >I'm looking to produce the following output
> ><tr>
> >  <td> 1 </td>
> >  <td> 2 </td>
> ></tr>
> ><tr>
> >  <td> A </td>
> >  <td> B </td>
> ></tr>
> >
> >
> >here is my xsl code below, does anyone knows what am I missing ?
> >...
> ><xsl:for-each select="line">
> >  <tr>
> >    <xsl:for-each select="@*">
> >      <td> <xsl:value-of select="@name()"/> </td>
> This is asking for the name of an attribute of the current node, which
> is itself an attribute : it will return nothing.
> 
> If you want the value of the attribute (e.g. '1') then say
>   <td> <xsl:value-of select="."/> </td>
> ( . (dot) means the current node)
> 
> If you want the name of the attribute (e.g. 'c1') then say
>   <td> <xsl:value-of select="name()"./> </td>
> (the name of the current node)
> 
> Regards,
> Trevor Nash
> --
> Traditional training & distance learning,
> Consultancy by email
> 
> Melvaig Software Engineering Limited
> voice:     +44 (0) 1445 771 271 
> email:     tcn@xxxxxxxxxxxxx
> 
>  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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.