xslt-fo - how do I indent second line of an index entry?

Posted on 2008-11-05
Last Modified: 2013-11-18
When I use <xsl:value-of select="$currentTerm"/> and the text string is long, I get some thing like:

asdfasdf sadfasdf asdfasdf asdfasdf
asdf 1-2

What I want is the second line indented like:

asdfasdf sadfasdf asdfasdf asdfasdf
    asdf 1-2

How can I accomplish this?
Question by:aeijohn
    LVL 6

    Accepted Solution

    Add <div style="padding-left: 20px; text-indent: -20px;"> and </div> around it.
    LVL 11

    Expert Comment

    Hi aeijohn,

    We had to cheat by creating a series of list items, and indenting and outdenting to get the desired effect. Take a look at the attached PNG to see the result. Here is a snippet of how we handle it.

    This is for a table of contents, and to get an entire word to break properly, we append a series of periods to make a whole word (notice text "wrap around sometime......"). It is a kluge but works.

    The indentation is nothing more than a combination of outdenting and indenting. Notice the following attributesL

    text-indent="-.125in" end-indent=".5in" last-line-end-indent="-.5in"


    <fo:list-item start-indent="0in">
    	<fo:list-item-label end-indent="label-end()">
    		<fo:block font-family="Arial" font-size="10pt" font-weight="normal" text-align="left">
    			<fo:inline>Table A-22</fo:inline>
    	<fo:list-item-body start-indent="1.125in">
    		<fo:block font-family="Arial" font-size="10pt" keep-together.within-page="always" text-align-last="justify" text-indent="-.125in" end-indent=".5in" last-line-end-indent="-.5in">
    			<fo:inline>Power Distribution Assembly to Reader Motor Cable Assembly Wire List this is a very very very long title and it must wrap around sometime......</fo:inline>
    			<fo:leader leader-pattern="dots" keep-with-previous.within-line="always"/>
    			<fo:inline padding-start="1pt" wrap-option="no-wrap" keep-together.within-line="always" keep-with-previous.within-line="always">A-<fo:page-number-citation ref-id="tQ3318565"/></fo:inline>

    Open in new window

    LVL 11

    Expert Comment

    Oops, I forgot to attach the PNG, so here it is...

    Author Closing Comment

    Actually I added the padding-left: 20px; text-indent: -20px; to  tag no matter where I placed it.
    But your answer got me to where I wanted so I am accepting this as the solution.

    Thank you
    LVL 11

    Expert Comment

    Wow. Your title is specific to XSL:FO. Does Werrock's solution work for XSL:FO?

    Author Comment

    Well, yes and no. The <div> tag was not welcomed and caused errors every where I tried to use it. But Werrock's solution put me on the path of using text-ident with a negitive value and then shifting the left margin over to compensate for it. This worked very well and I was able to get the index output as I wanted.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Javascript: Crash Course

    Javascript is not only emerging as the most important language to know, it's flexibility is unique. With Javascript being deployed on the web, mobile and even the desktop this is the one language that all technologists need to know.

    Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System ( introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
    Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
    The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now