Loading ...
Sorry, an error occurred while loading the content.

RE: [XSL-FO] Nested lists

Expand Messages
  • G. Ken Holman
    ... This turns out to be simpler than originally thought. Provided your subordinate display relationship is based on a sibling source relationship, you can
    Message 1 of 5 , Dec 29, 2003
    • 0 Attachment
      At 2003-12-29 13:00 -0500, Norma Yeazell wrote:
      >Here is my xml:
      >
      ><step1 id="step1-6">
      ><title>step1 title</title>
      ><para>This is a step 1.
      ><randlist
      >prefix="endash" 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 prefix="bull" 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 prefix="bull" 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@...
      Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
      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/f/bc
    Your message has been successfully submitted and would be delivered to recipients shortly.