You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Ju...@mincom.com on 2003/05/06 08:41:20 UTC
Trying to render lines different ways
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.
Re: Trying to render lines different ways
Posted by "J.Pietschmann" <j3...@yahoo.de>.
Julie.Hansen@mincom.com wrote:
> I can;t see why the extra line of 'line4line5line6' is being printed.
See
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17472
J.Pietschmann
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
Re: Trying to render lines different ways
Posted by Jeremias Maerki <de...@greenmail.ch>.
Not really a FOP question, right? An XSL-dedicated list would have been
more appropriate. :-)
Anyway, I've attached a ZIP (with XML and XSL) that demonstrates what
you want to do.
On 06.05.2003 08:41:20 Julie.Hansen wrote:
> 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
<snip/>
> 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?
Jeremias Maerki