xsl-list
[Top] [All Lists]

Re: [xml-dev] Indentation using xsl

2005-06-21 08:08:44

[ I removed  xml-dev(_at_)lists(_dot_)xml(_dot_)org,]

Your question isn't very clear.
Firstly do you just want to indent teh generated html file (for
readability) or do you want the browser to indent the result?


  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 

From this part I assumed that you wanted each NAME to be indented by one
more space. However that wouldn't use the LEVEL element at all.

  Thatswhy I've added  <LEVEL> above that.

So I assume you wantto indent by the LEVEL number.

  This is what I'm thinking
 
  For each level
    write<td>
  Loop level
  Add NAME

I don't understand this part at all (XSLT never writes tags such as an
unmatched <td> and td elements are only used in tables which your output
isn't using?

Perhaps you want

    <B CLASS="hi">
  <xsl:for-each 
select="(//*)[position()&lt;=current()/LEVEL">&#160;</xsl:for-each>
  <xsl:value-of select="NAME"/>
  </B><br/>

which adds LEVEL nbsp before the NAME.

Or better just do


    <div CLASS="hi{LEVEL}">
  <xsl:value-of select="NAME"/>
  </div>

and arrange in your css that

div.hi1
div.hi2
div.hi3

etc have a suitable left margin specified.



David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>
  • Re: [xml-dev] Indentation using xsl, David Carlisle <=