RE: [xsl] Re: Indendation(in HTML) corresposing to the heirarchy in an XML Doc.

Subject: RE: [xsl] Re: Indendation(in HTML) corresposing to the heirarchy in an XML Doc.
From: Jarno.Elovirta@xxxxxxxxx
Date: Tue, 24 Jun 2003 10:08:30 +0300
Hi,

> My 'inputs' look like this when i converted to HTML:
> 
> 	Inputs:
> 
> 	     id;getImage;binField;contractName;packageName;
> 
> This is how I want them to look like:
> 
> 	Inputs
>     	    <icon>id
>     	    <icon>binField
>     	    <icon>anotherContainer
>     		<icon>contractName
>                         <icon>getImage
>                 <icon>packageName
>      	       .   .
>      	       .   .
> 
> The XML is a normal XML which follows this tag heirarchy. Thank you in
> advance.

It would have helped if you had shown us your actual XML input, but you can get the indentation level e.g. with

  <xsl:attribute name="style">
    <xsl:value-of select="concat('margin-left:', 'count(ancestor::*) * 2, 'em'"/>
  </xsl:attribute>

or 

  <xsl:for-each select="ancestor::*">&#xA0;</xsl:for-each>

or just generate div elements to reconstruct the hierarchy and use the same left margin for all of them, i.e.

  <div>
    <div>
    	<img ...>anotherContainer
	<div>
        <img ...>contractName

and so forth.

Cheers,

Jarno - VNV Nation: Chosen


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


Current Thread