xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julie.Han...@mincom.com
Subject Trying to render lines different ways
Date Tue, 06 May 2003 06:41:20 GMT
Hi All,

I am fairly new to fop and have come across a problem that I am finding 
difficult to solve.


I have some XML which contains (among other things), 7 <Line> elements. I 
want to render these lines so that the first 3 <Line> elements appear on 
seperate lines, the next 3 appear on one line, and the final <Line> 
appears on its own line.......

eg 

<Line>line1</Line>
<Line>line2</Line>
<Line>line3</Line>
<Line>line4</Line>
<Line>line5</Line>
<Line>line6</Line>
<Line>line7</Line>

needs to be rendered as

line1
line2
line3
line4 line5 line6
line7

I have tried using the keep-with-next.within-line attribute which I have 
discovered does not work.

I have tried writting a for each loop which uses the position() attribute 
to determine the line as follows

                           <fo:block font-size="10pt" text-align="left">
                           <xsl:for-each select="Line">
                              <xsl:variable name="pos"><xsl:number 
value="position()"/></xsl:variable>

                                <xsl:choose>
                                  <xsl:when test="$pos=4">
                                    <fo:inline font-size="10pt" 
text-align="left">
                                      <xsl:value-of select="."/>
                                    </fo:inline>
                                  </xsl:when>
                                  <xsl:when test="$pos=5">
                                    <fo:inline text-indent="10mm" 
font-size="10pt" text-align="left">
                                      <xsl:value-of select="."/>
                                    </fo:inline>
                                  </xsl:when>
                                  <xsl:when test="$pos=6">
                                    <fo:inline text-indent="10mm" 
font-size="10pt" text-align="left">
                                       <xsl:value-of select="."/>
                                    </fo:inline>
                                  </xsl:when>
                                  <xsl:otherwise>
                                        <fo:block font-size="10pt" 
text-align="left"><xsl:value-of select="."/>
                                        </fo:block>
                                  </xsl:otherwise>
                                </xsl:choose>
                            </xsl:for-each>
                            </fo:block>
but this causes the following output

line1
line2
line3
line4line5line6
line7
line4line5line6

I can;t see why the extra line of 'line4line5line6' is being printed. 

I also tried putting a start block when the position is 4, and an end 
block when the position is  but of course...this is not valid xml.

Has anyone come across this before or have any suggestions or pointers for 
me?

Many Thanks
Julie


-- 
This transmission is for the intended addressee only and is confidential information. If you
have received this transmission in error, please notify the sender and delete the transmission.
The contents of this e-mail are the opinion of the writer only and are not endorsed by the
Mincom Group of companies unless expressly stated otherwise.


Mime
View raw message