Re: [xsl] Atypical list

Subject: Re: [xsl] Atypical list
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 26 Feb 2009 08:16:50 -0500
At 2009-02-26 14:04 +0100, Konstanty Pilecki wrote:
As a beginner at XSL-FO standard I have a
problem with a list (enumeration). The thing is
that the list in my XML document is not typical.

Because of transformation, your XML document can have any content and it is up to your algorithm to create only the constructs needed by the XSL-FO.

It consists not only of regular enumerated items
but also has binsertionsb, which are integral components of the list.

Fine. In my XSL-FO training material, I refer to this as the need for a "ghost list item" that isn't a list item in the abstract but needs to be a list item in order to belong in a list.

An example of such list:

<list>
  <item1></item1>
  <item2></item2>
  <insertion></insertion>
  <item3></item3>
<list>

In order to format such list, I can not use a <fo:list-block> element,

But you can.


because a model of this does not allow
insertions (like has been described above).

Correct, but you can create a ghost list item and format the insertion into the body of the ghost list item. An example is posted below.

Hence, I think, bordinary textb should be used.

I disagree.


And here is a problem. An item of the list
consists of a label and content. A content
element can have a quite complex structure and
is wrapped in a <fo:block> element (<fo:block>
element can also appear repeatedly at lower
levels of the list item contentbs structure).
The list item would be like this:

<fo:inline>
  <!Item label here -->
</fo:inline>
<fo:block>
  <!Item content here -->
</fo:block>

That will not help you because of the architecture of XSL-FO.


The <list-block> construct is the one you want to
use because it is designed precisely for the kind of labeling needed for
lists.

What should I do, in order to an XSL-FO to PDF
processor does not break a text line after the label?

If I have understood your requirement correctly, I suggest you follow the model below in your XSL-FO. Use the traditional list item approach for your list items, and when you encounter your insertion information, utilize a ghost list item with an invisible label.

I hope this helps.

. . . . . . . . Ken

<?xml version="1.0" encoding="US-ASCII"?><!--pilecki.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">
      <block>This is a test</block>
      <list-block provisional-distance-between-starts="1.5cm"
                  provisional-label-separation=".25cm">
        <list-item>
          <list-item-label end-indent="label-end()">
            <block>1</block>
          </list-item-label>
          <list-item-body start-indent="body-start()">
            <block>abc</block>
          </list-item-body>
        </list-item>
        <list-item>
          <list-item-label end-indent="label-end()">
            <block>2</block>
          </list-item-label>
          <list-item-body start-indent="body-start()">
            <block>def</block>
          </list-item-body>
        </list-item>

        <!--this is the ghost list item-->
        <list-item>
          <list-item-label end-indent="label-end()">
            <!--this is the invisible ghost list item label-->
            <block/>
          </list-item-label>
          <list-item-body start-indent="body-start()">
            <!--here is the insertion information-->
            <block>insertion information here</block>
          </list-item-body>
        </list-item>

        <list-item>
          <list-item-label end-indent="label-end()">
            <block>3</block>
          </list-item-label>
          <list-item-body start-indent="body-start()">
            <block>ghi</block>
          </list-item-body>
        </list-item>
      </list-block>
    </flow>
  </page-sequence>
</root>


-- XQuery/XSLT training in Prague, CZ 2009-03 http://www.xmlprague.cz Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal

Current Thread