[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Identity Transformation of XML for web display


Subject: Re: [xsl] Identity Transformation of XML for web display
From: Robert Koberg <rob@xxxxxxxxxx>
Date: Tue, 21 Mar 2006 05:55:52 -0500

Wendell Piez wrote:
Karl,

This is not hard to do, either with literal spaces (non-breaking spaces) or with CSS when displaying HTML.

You looks like you're using CSS. If you're using a @class layer, it looks like the class of any particular div will be done like this:

<div class="indent_{count(ancestor-or-self::*)}">...</div>

which would result in class="indent_1" for an outermost div, "indent_2" for a div a level down, etc.

You could do the same thing with style="{count(ancestor::*) * 10}px"> and get your indents hard-coded that way: this would result in 0px, 10px, 20px etc from outermost in.


Hi,

I don't think this is what you want. The indentation will be relative to the parent div. You probably just want to have a single 'indent' class with a margin-left or padding-left of 10px. This way the first div[@class='indent'] will be indented 10px from the body's margin or padding, the first child div[@class='indent'] of the parent will be 20px from the left of the body and so on.

I also think it is a good idea to keep the CSS separate from the transformed result and not use inline style attributes (just to try and make this post a little on topic :)

best,
-Rob



I hope that helps.


Cheers,
Wendell

At 07:49 PM 3/18/2006, you wrote:

Hello,

I'd like to create an identity tranformation that replaces "<" this
and ">" this to "&lgt;" and "&glt" for display of the XML document on
an HTML page.  I can handle this part, but would like help with the
spacing of the elements as they appear hierachely.  So example, how to
space:

into

<A>
   <B>
       <C/>
   </B>
</A>

you have to be very intuitive as to knowing at which depth you are in
your transformation to style this something like:


<div style="indent_3">&glt;C&glt;</div>


where style indent_3 is a margin of 20px for example.

Any help would be appreciated.



====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================


Current Thread
Keywords
xml