You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Christian Barth <co...@barth-zone.de> on 2006/01/17 17:51:20 UTC

XSLT - How can I get the element name?

Hi!
 
Let's say I have the following XML:
 
<wurste>
    <wurst>
        <name>XY</name>
        <typ>ZZ</typ>
        <bla>VV</bla>
    </wurst>
</wurste>
 
Now I want to transform this with XSLT to html. The result should be a table
looking like this:
 
name    |    XY
typ        |    ZZ
bla        |    VV
 
 
I know I could do it like this:
 
<table>
    <tr>
        <td>name</td><td><xsl:value-of select="name" /></td>
    </tr>
    <tr> 
        <td>typ</td><td><xsl:value-of select="typ" /></td>
    </tr>
 
and so on.
 
 
But is there a way to get the name of the Element automatically? Then I
could fill in the table in a for-each-loop.
 
 
Thanks,
Barthi

Re: XSLT - How can I get the element name?

Posted by Bertrand Delacretaz <bd...@apache.org>.
Le 17 janv. 06, à 18:05, Christian Barth a écrit :

> ...But where can I find such informations?

The XSLT-List is a good source, see 
http://www.dpawson.co.uk/xsl/list.html

-Bertrand


Re: XSLT - How can I get the element name?

Posted by christian bindeballe <ot...@gmail.com>.
Christian Barth schrieb:
> Oh, that easy!
> 
> But where can I find such informations?
> 
> Greets,
> BArthi 

you probably won't find a place in the internet where you could ask such 
a question and get an automated answer, but maybe this will help

http://www.topxml.com/xsl/default.asp

or just searching for XSL or xpath in google or yahoo or whatever.
or maybe buy a book ;) that's what I did
there is a nice reference about XSLT 2.0 by Michael Kay, at WroxPress 
and also a german XSLT-Book from O'Reilly called "XSLT" ;)

ISBN: 0-7645-6909-0
ISBN: 3-89721-292-7

both are highly recommended

regards, christian

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: XSLT - How can I get the element name?

Posted by Christian Barth <co...@barth-zone.de>.
Oh, that easy!

But where can I find such informations?

Greets,
BArthi 

> -----Original Message-----
> From: Geert Josten [mailto:Geert.Josten@daidalos.nl] 
> Sent: Tuesday, January 17, 2006 5:56 PM
> To: users@cocoon.apache.org
> Subject: Re: XSLT - How can I get the element name?
> 
>    <xsl:value-of select="local-name()" />
> 
> Cheers
> 
> Christian Barth wrote:
> 
> > But is there a way to get the name of the Element 
> automatically? Then 
> > I could fill in the table in a for-each-loop.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: XSLT - How can I get the element name?

Posted by Geert Josten <Ge...@daidalos.nl>.
   <xsl:value-of select="local-name()" />

Cheers

Christian Barth wrote:

> But is there a way to get the name of the Element automatically? Then I 
> could fill in the table in a for-each-loop.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org