xsl-list
[Top] [All Lists]

Re: xsl:for-each question

2003-10-30 06:22:10
Thank you very much, you´re right. I´m yet not really in the thinking of templates. I still try to "program" my xslt like I´m used to do it with Java-Programs.
But how can I do it, that the @name appears in a diffrent td.
The html output shoul look in text Form like:
Menu1        Submernu1
                  Submenu2
                  Submenu3         SubSubmenu1
                                           SubSubmeu2
                  Submenu4
                  Submenu5         SubSubmenu1
                                           SubSubmenu2
Menu2        Submenu1         SubSubmenu1
                                           SubSubmenu2

So I need to make the template varaible from the depth of the topic-level.

<xsl:template match="topic">
   <td>
     <xsl:value-of select="@name"/>
   </td>
   <td>
   </td>
   <xsl:apply-templates/>
 </xsl:template>

Also if I´m in a topic level and there are more childs, the name of this topic 
level should not be displayed anymore, till every child was displayed.

Thanks for your help

Take care Michael



r(_dot_)devries(_at_)tjip(_dot_)com wrote:

Hi Michael,

What David means is that XSL is a template language and you have to learn
to think in templates, not in for-each.
The node you want to do something with is "topic", so write a template for
it.
Maybe this example will help you on the way (the depth of nesting in
"topic" doesn't matter, the template will call itself):

<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform";>
 <xsl:output method="html"/>

 <xsl:template match="*">
   <table border="1">
     <tbody>
       <tr>
          <xsl:apply-templates/>
       </tr>
     </tbody>
   </table>
 </xsl:template>

 <xsl:template match="topic">
   <td>
     <xsl:value-of select="@name"/>
   </td>
   <xsl:apply-templates/>
 </xsl:template>

</xsl:stylesheet>


Greetings René
  {@   @}
       ^
     \_/

"You don't need eyes to see, you need vision!"

TJIP PCL
Steenovenweg 3
5708 HN  Helmond
The Netherlands
tel: +31(0) 492 502 226
fax: +31(0) 492 502 299
e-mail: R(_dot_)deVries(_at_)tjip(_dot_)com
internet: www.tjip.com

***************************DISCLAIMER********************************
Deze e-mail is uitsluitend bestemd voor de geadresseerde(n).
Verstrekking aan en gebruik door anderen is niet toegestaan.
TJIP PCL sluit iedere aansprakelijkheid uit die voortvloeit uit
elektronische verzending.

This e-mail is intended exclusively for the addressee(s), and may
not be passed on to, or made available for use by any person
other than the addressee(s). TJIP PCL rules out any and every liability
resulting from any electronic transmission.


XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


--
Michael Olszynski Dipl.-Ing.(FH)
Software Engineer

___ |X__________________________________________________________
  X|

eXXcellent solutions gmbh
In der Wanne 55

D-89075 ulm

e | m(_dot_)olszynski(_at_)exxcellent(_dot_)de
t | +49 [0]731-55026-39
f | +49 [0]731-55026-99
i | www.exxcellent.de
________________________________________________________________

Geschäftsführer: Dr. Martina Maier, Wilhelm Zorn, Gerhard Gruber
Sitz der Gesellschaft: Ulm, Registergericht: Ulm HRB 4309





XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>