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

RE: Indenting Blocks in HTML Output

Subject: RE: Indenting Blocks in HTML Output
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Sat, 20 Jul 2002 17:52:54 +0100
html list indentation
There are two ways to do this. One is to pass the current depth (or the
indentation string) as a parameter when you do the apply-templates. The
other is, when processing each node, use count(ancestor::*) to determine
its depth in the original tree.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> xml@xxxxxxxxxxxxxxxxxxxxx
> Sent: 19 July 2002 22:07
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Indenting Blocks in HTML Output
> 
> 
> Hi,
> 
> I have an XML file, one of whose productions can be:
> 
>     <statement>
>         <startblock/>
>             <statement_list>...</statement_list>
>         <endblock/>
>     </statement>
> 
> 
> This represents statement blocks in a traditional programming 
> language, for example:
> 
> 	if (condition)
> 	{
>             statement1;
>             statement2;
>             ...
>             statementN;
> 	}
> 
> 
> My XSL file tries to create HTML from my XML file, and I 
> would like it to indent statement blocks like these.
> 
> I initially tried something like this:
> 
>   <xsl:template match="statement[ *[1]/self::startblock and 
> *[2]/self::statement_list and *[3]/self::endblock ]">
> 	<xsl:apply-templates select="*[1]"/>
> 	<xsl:text>&#160;&#160;&#160;&#160;</xsl:text>
> 	<xsl:apply-templates select="*[2]"/>
> 	<xsl:apply-templates select="*[3]"/>
>   </xsl:template>
> 
> But, this of course only indents the first line.  Not to be 
> discouraged, I tried using <dd>s, <ul>s, and <ol>s instead.  
> These do the correct indenting, and look perfect in Internet 
> Explorer and Mozilla.  However, they put extra lines in when 
> using the Java EditorPane class which is what I ultimately 
> need to display this in.
> 
> I'm wondering if there's a nice way of just doing the &#160; 
> thing but making it propogate down throughout the rest of the 
> rules?  Otherwise if anyone else has an idea on how to solve 
> this, that would be great.
> 
> Thanks a lot!
> 
> 	Jared
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


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


Current Thread

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
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.