[Home] [By Thread] [By Date] [Recent Entries]

  • To: puja thakral <puja_thakral@y...>, List <xsl-list@l...>, xml <xml-dev@l...>
  • Subject: Re: Indentation using xsl
  • From: puja thakral <puja_thakral@y...>
  • Date: Tue, 21 Jun 2005 08:47:00 -0700 (PDT)
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=qD9HZrtqU4MBi8JKlYRF8Sb+GZ9tkODi8OaFnJhOKeY1AzBfFHoaqFChCogZBYa8XeOXi5bgr+x6zPiTVfMn+a+C4OH0NdH3l1+zmJIeZe4RY8cWaD93AuMH4GrQgf1jrkKUblUr6pLxhg9lvnC/oRV3CaCNEtMfdQoys8X2yoY= ;
  • In-reply-to: <20050621145413.3516.qmail@w...>

Thanks for reply.Maybe I should be more clear in explaining my problem.
 
The output I want in my web browser is:
 
About ORSP
Staff     Policies
 
       Funding Sponsored Links
        Funding Links      COS
 
 
 
Funding Sponsored Links should be indented.I should have the flexibility to put the indentation.I know I'll have to apply 'for loop' but I was not sure how to do that exactly.
I hope I explained it a little better.Kindly let me know if u think it's still unclear.
 
Thanks,
Puja
      
 


puja thakral <puja_thakral@y...> wrote:
Hi,
I'd put a lot of effort solving this problem.Hope someone helps me here....
 
I've an XML document
 
<CATEGORIES>
 
<CATEGORY>
  <LEVEL>1</LEVEL> 
   <NAME>About ORSP</NAME>
   
    <LINKS>
      <LINK>
       <LINKNAME>Staff</LINKNAME>
       <LINKURL>/Staff.asp</LINKURL>
      </LINK>
        <LINK>
       <LINKNAME>Policies</LINKNAME>
       <LINKURL>/Policies.asp</LINKURL>
      </LINK>
     </LINKS>
    </CATEGORY>
 
  <CATEGORY>
  <LEVEL>2</LEVEL>
   <NAME>Funding Sposored Funding</NAME> 
    <LINKS>
      <LINK>
       <LINKNAME>Funding Links</LINKNAME>
       <LINKURL></LINKURL>
      </LINK>
      <LINK>
       <LINKNAME>COS</LINKNAME>
       <LINKURL></LINKURL>
      </LINK>
      </LINKS>
    </CATEGORY>
<CATEGORIES>
 
My xsl looks like this..
 
<xsl:for-each select="CATEGORIES/CATEGORY">
    <img src="javascript:void(0);" alt="" width="12" height="11" border="0" title=""/>
                
    <B CLASS="hi"><xsl:value-of select="NAME"/></B><br/>
           
       <xsl:for-each select="LINKS/LINK">
      <a href="{LINKURL}" target="_blank"><xsl:value-of select="LINKNAME"/>
     </xsl:for-each>
</xsl:for-each><br/>
 
Now I know I'm pulling the <NAME> from the xml document.But I want to add indentation to it.Say I want the <NAME> to be indented by one one space in the first CAtegory and I want the <NAME> to be indented by 2 sapces in the second category and so on.Thatswhy I've added  <LEVEL> above that.
 
This is what I'm thinking
 
For each level
  write<td>
Loop level
Add NAME
 
For each level+1
Write <td>
Loop level.
 
Can I achieve something like this.I'll really appreciate if someone can help me with this.
Thanks,
Puja


Do you Yahoo!?
http://us.rd.yahoo.com/my/navbar/sethp/*http://www.yahoo.com/r/hs

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member