Re: [xsl] relative relative indents

Subject: Re: [xsl] relative relative indents
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sun, 26 Nov 2006 08:36:12 -0400
At 2006-11-26 00:23 -0800, Bob Stayton wrote:
Is there a way to form relative relative indents in XSL-FO 1.0?
Here, the first "relative" means relative to the writing mode, and
the second "relative" means relative to the containing block.
I'm trying to create nested indents from nested source elements
in a language-independent stylesheet, and I'm not finding
the right property combination.

I can see an object combination and a property combination:


For example, in left-to-right writing mode, I can use margin-left
in nested fo:block elements:

<fo:block margin-left="1in">First block.
 <fo:block margin-left="1in">Second block.
   <fo:block margin-left="1in">Third block.
   </fo:block>
 </fo:block>
</fo:block>

The third block will be indented 3in from the left region boundary.

But "margin-left" is an absolute property.  If I use this stylesheet
for a language in writing mode right-to-left, this does not have
the intended effect.  At first I thought that
space-start would be the corresponding property that is relative
to the writing-mode.  But space-start only applies to inline areas,
not block areas.

But they are relative to the reference area, so you could introduce a reference area in each block by a block-container.


There doesn't seem to be a "margin-start" property, and start-indent
does not produce the same additive effect.  Is there any way to
accomplish this nesting of indents without having to resort to
using nested list-blocks or computing a sum for a start-indent?

Remember that you can express the sum without computing the sum and let the FO processor do the computation for you ... will that help?


So, my two suggestions are nested block-containers and arithmetic expression.

Examples below.

I hope this helps, Bob.

. . . . . . . . . . Ken

<?xml version="1.0" encoding="US-ASCII"?><!--raw.fo-->
<root xmlns="http://www.w3.org/1999/XSL/Format";
      font-family="Times" font-size="20pt">

  <layout-master-set>
    <simple-page-master master-name="frame"
                        page-height="297mm" page-width="210mm"
                        margin-top="15mm" margin-bottom="15mm"
                        margin-left="15mm" margin-right="15mm">
      <region-body region-name="frame-body"/>
    </simple-page-master>
  </layout-master-set>

  <page-sequence master-reference="frame">
    <flow flow-name="frame-body" xmlns="http://www.w3.org/1999/XSL/Format";>
      <block>This is a test with margin-left</block>
<block margin-left="1in">First block.
 <block margin-left="1in">Second block.
   <block margin-left="1in">Third block.
   </block>
 </block>
</block>

      <block>This is a test with start-indent</block>
<block start-indent="1in">First block.
 <block start-indent="1in">Second block.
   <block start-indent="1in">Third block.
   </block>
 </block>
</block>

      <block>This is a test with arithmetic expressions</block>
<block start-indent="1in">First block.
 <block start-indent="1in+1in">Second block.
   <block start-indent="1in+1in+1in">Third block.
   </block>
 </block>
</block>

      <block>This is a test with block containers</block>
<block start-indent="1in">First block.
 <block-container>
   <block start-indent="1in">Second block.
     <block-container>
       <block start-indent="1in">Third block.
       </block>
     </block-container>
   </block>
 </block-container>
</block>

    </flow>
  </page-sequence>
</root>

--
World-wide corporate, govt. & user group XML, XSL and UBL training
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread