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

Indentation using xsl

  • To: List <xsl-list@l...>, xml <xml-dev@l...>
  • Subject: Indentation using xsl
  • From: puja thakral <puja_thakral@y...>
  • Date: Tue, 21 Jun 2005 07:54:13 -0700 (PDT)
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=sdNiVAvpm/P0NuarU3bRjFKRPRhFFLzyBF0YhpwLL9juEmhMLczdSdlciKZf5mFnTd/3euFf/dJlu6ygpqZ92xD36bg/bO+2yQHaM7Z4zF9XqnoZrkolgisZKcoyfxa/83TxHtqF/Vp4V2YnyW6strzbgyZq1Jilvk/DlxE8dwc= ;

xsl indentation
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

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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.