RE: [xsl] randlist followed by randlist with different indents

Subject: RE: [xsl] randlist followed by randlist with different indents
From: "Norma Yeazell" <Nyeazell@xxxxxxxxx>
Date: Tue, 30 Dec 2003 09:26:24 -0500
Thanks Ken, this works but I left out one little detail. The first
randlist starts with a bullet the second with a en-dash and the third
with a bullet. Any ideas how I can make that work? 

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of G. Ken
Holman
Sent: Monday, December 29, 2003 7:49 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] randlist followed by randlist with different indents

At 2003-12-29 15:23 -0500, Norma Yeazell wrote:
>I have 3 randlist in a row within a paragraph, the first should be at 
>left the next two indented diffently. Can anyone give me a clue how to 
>get this accomplished?
>...
><step1 id="step1-6">
><title>step1 title</title>
><para>This is a step 1.
><randlist id="randlist-6">
><item>Be careful not to short out battery terminal. </item> <item>Do 
>not smoke or use open flame near batteries. </item> <item>Batteries may

>explode from spark.</item> </randlist> <randlist id="randlist-7"> 
><item>Sub-unordered list items start with a bullet indented 7mm for the

>left type limit.</item> <item>The items within a sub-unordered list 
>shall not be separated with a blank line.</item> </randlist> <randlist 
>id="randlist-8"> <item>Subsub-unordered list items start with a bullet >indented 14mm for the left type limit.</item> <item>The items within a 
>sub-unordered list shall not be separated with a blank line.</item> 
></randlist> </para>
><step2 id="step2-2">
><title>This is a sample title for a step 2</title> <para>This is a step

>2.</para> </step2> </step1>

This turns out to be simpler than originally thought.  Provided your
subordinate display relationship is based on a sibling source
relationship, you can take advantage of XSL-FO's support of expressions
as follows:

<xsl:template match="randlist">
   <list-block start-indent="{count(preceding-sibling::randlist)} *
7mm">
     <xsl:apply-templates/>
   </list-block>
</xsl:template>

<xsl:template match="item">
   <list-item provisional-distance-between-starts="1cm">
     <list-item-label end-indent="label-end()">
       <block>1</block>
     </list-item-label>
     <list-item-body start-indent="body-start()">
       <block><xsl:apply-templates/></block>
     </list-item-body>
   </list-item>
</xsl:template>

In the above you are indenting 7mm for each list after the first list by
counting the number of preceding sibling randlist elements and
multiplying that count by 7mm.

I hope this helps.

................................ Ken

--
North America (Washington, DC): 3-day XSLT/2-day XSL-FO 2004-02-09
Instructor-led on-site corporate, government & user group training for
XSLT and XSL-FO world-wide:  please contact us for the details

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)
ISBN 0-13-065196-6                       Definitive XSLT and XPath
ISBN 0-13-140374-5                               Definitive XSL-FO
ISBN 1-894049-08-X   Practical Transformation Using XSLT and XPath
ISBN 1-894049-11-X               Practical Formatting Using XSL-FO
Member of the XML Guild of Practitioners:     http://XMLGuild.info
Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/s/bc


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



Confidentiality Notice
The information contained in this e-mail is confidential and intended for use only by the person(s) or organization listed in the address. If you have received this communication in error, please contact the sender at O'Neil & Associates, Inc., immediately. Any copying, dissemination, or distribution of this communication, other than by the intended recipient, is strictly prohibited.


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


Current Thread