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 Rob Sargent <rs...@xmission.com> on 2013/08/28 01:24:22 UTC
Does fop-1.1 block-container respect "top" attribute?
I cannot seem to push a block down using 'top="n"' set to any value n >
0 (and < 1 of course)
I've even added an extra, enclosing (superfluous?) block-container
inside the table-cell. "left" and "right" are working just fine but
"top" not so much.
I thought this was a compliant piece of FOP. Am I wrong about that or
just doing something stupid again. (Hey, I've been away awhile).
Thanks.
My xsl: this template is called as the table-cell is laid out.
<xsl:template name="scout-image">
<xsl:param name="curpage"/>
<xsl:param name="curpos"/>
<xsl:param name="imageCount"/>
<xsl:if test="contains($curpage/@layout-id, 'scout') and
count($curpage/image[@pos = $imageCount + $curpos]) = 1">
<xsl:variable name="scoutsize">
<xsl:choose>
<xsl:when test="$imageCount = 3">
<xsl:value-of select="number(0.9)"/>
</xsl:when>
<xsl:when test="$imageCount = 1">
<xsl:value-of select="number(1.0)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="number(1.25)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<fo:block-container>
<fo:block-container position="absolute" z-index="-1"
height="{$scoutsize}in" width="{$scoutsize}in">
<xsl:choose>
<xsl:when test="$curpage/@pos mod 2 = 0">
<xsl:attribute name="left">
<xsl:value-of select="0"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="right">
<xsl:value-of select="0"/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="$imageCount = 1">
<xsl:attribute name="top">
<xsl:value-of select="0.1"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="top">
<xsl:value-of select="0"/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="show-image">
<xsl:with-param name="img"
select="$curpage/image[@pos= $curpos + $imageCount]" />
<xsl:with-param name="width" select="$scoutsize" />
<xsl:with-param name="height" select="$scoutsize" />
<xsl:with-param name="addBlack" select="false()" />
</xsl:call-template>
</fo:block-container>
</fo:block-container>
</xsl:if>
</xsl:template>
My fop:
<fo:table-cell>
<fo:block-container>
<fo:block-container width="1in" height="1in" z-index="-1"
position="absolute" left="0" top="0.1">
<fo:block>
<fo:external-graphic border-collapse="separate"
content-height="1in" content-width="1in" display-align="center"
src="ref_scout_3_0_650043924" />
</fo:block>
</fo:block-container>
</fo:block-container>
<fo:block-container width="1.2102857142857144in"
top="3.9297774842857143in" position="absolute" left="0.0in" height="0.6in">
<fo:block linefeed-treatment="preserve"
white-space-collapse="false" font-size="8pt"
font-family="StoneSerif">Anterior surface of patella</fo:block>
</fo:block-container>
<fo:block-container width="1.2102857142857144in"
top="5.698118852857143in" position="absolute" left="0.0in" height="0.6in">
<fo:block linefeed-treatment="preserve"
white-space-collapse="false" font-size="8pt"
font-family="StoneSerif">Patellar tendon</fo:block>
</fo:block-container>
<fo:block-container width="1.2102857142857144in"
top="2.4832606942857147in" position="absolute" left="0.0in" height="0.6in">
<fo:block linefeed-treatment="preserve"
white-space-collapse="false" font-size="8pt"
font-family="StoneSerif">Quadriceps tendon</fo:block>
</fo:block-container>
</fo:table-cell>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Does fop-1.1 block-container respect "top" attribute?
Posted by Rob Sargent <rs...@xmission.com>.
Thanks! I misread the compliance list. I'll give those suggestions a shot.
Btw, I never got any suggestion from Glen. Just the two PSs as you show
below.
rjs
On 08/28/2013 02:11 AM, Pascal Sancho wrote:
> Hi,
>
> top is one of the relative position properties, when applied to the
> fo:block (see [1] & [2]).
> Currently, FOP doesn't implement such properties (see [2]).
>
> I see 2 workaround alternatives:
> As Glenn said, you should use absolute ones that come with fo:block-container:
> <fo:block-container abolute-position="absolute" top="1in">
> <fo:block>...</fo:block>
> </fo:block-container>
>
> Or play with space-before property:
> <fo:block
> space-before="-0.5em"
> space-before.conditionality="retain"
>> ...</fo:block>
>
>
> [1] http://www.w3.org/TR/xsl/#fo_block
> [2] http://www.w3.org/TR/xsl/#common-relative-position-properties
> [3] http://xmlgraphics.apache.org/fop/compliance.html#fo-property-commonrelpos-section
>
>
> 2013/8/28 Glenn Adams <gl...@skynav.com>:
>> P.S. In the future, don't bother sending the XSLT if your question is
>> related to formatting. Only the XSL-FO content is relevant.
>>
>> P.S.S. Why do you use nested block containers for the first block?
>>
>>
>> On Tue, Aug 27, 2013 at 5:24 PM, Rob Sargent <rs...@xmission.com> wrote:
>>> I cannot seem to push a block down using 'top="n"' set to any value n > 0
>>> (and < 1 of course)
>>>
>>> I've even added an extra, enclosing (superfluous?) block-container inside
>>> the table-cell. "left" and "right" are working just fine but "top" not so
>>> much.
>>>
>>> I thought this was a compliant piece of FOP. Am I wrong about that or
>>> just doing something stupid again. (Hey, I've been away awhile).
>>>
>>> Thanks.
>>>
>>> My xsl: this template is called as the table-cell is laid out.
>>>
>>> <xsl:template name="scout-image">
>>> <xsl:param name="curpage"/>
>>> <xsl:param name="curpos"/>
>>> <xsl:param name="imageCount"/>
>>> <xsl:if test="contains($curpage/@layout-id, 'scout') and
>>> count($curpage/image[@pos = $imageCount + $curpos]) = 1">
>>> <xsl:variable name="scoutsize">
>>> <xsl:choose>
>>> <xsl:when test="$imageCount = 3">
>>> <xsl:value-of select="number(0.9)"/>
>>> </xsl:when>
>>> <xsl:when test="$imageCount = 1">
>>> <xsl:value-of select="number(1.0)"/>
>>> </xsl:when>
>>> <xsl:otherwise>
>>> <xsl:value-of select="number(1.25)"/>
>>> </xsl:otherwise>
>>> </xsl:choose>
>>> </xsl:variable>
>>> <fo:block-container>
>>> <fo:block-container position="absolute" z-index="-1"
>>> height="{$scoutsize}in" width="{$scoutsize}in">
>>> <xsl:choose>
>>> <xsl:when test="$curpage/@pos mod 2 = 0">
>>> <xsl:attribute name="left">
>>> <xsl:value-of select="0"/>
>>> </xsl:attribute>
>>> </xsl:when>
>>> <xsl:otherwise>
>>> <xsl:attribute name="right">
>>> <xsl:value-of select="0"/>
>>> </xsl:attribute>
>>> </xsl:otherwise>
>>> </xsl:choose>
>>> <xsl:choose>
>>> <xsl:when test="$imageCount = 1">
>>> <xsl:attribute name="top">
>>> <xsl:value-of select="0.1"/>
>>> </xsl:attribute>
>>> </xsl:when>
>>> <xsl:otherwise>
>>> <xsl:attribute name="top">
>>> <xsl:value-of select="0"/>
>>> </xsl:attribute>
>>> </xsl:otherwise>
>>> </xsl:choose>
>>>
>>> <xsl:call-template name="show-image">
>>> <xsl:with-param name="img"
>>> select="$curpage/image[@pos= $curpos + $imageCount]" />
>>> <xsl:with-param name="width" select="$scoutsize" />
>>> <xsl:with-param name="height" select="$scoutsize" />
>>> <xsl:with-param name="addBlack" select="false()" />
>>> </xsl:call-template>
>>> </fo:block-container>
>>> </fo:block-container>
>>> </xsl:if>
>>> </xsl:template>
>>>
>>>
>>> My fop:
>>> <fo:table-cell>
>>> <fo:block-container>
>>> <fo:block-container width="1in" height="1in" z-index="-1"
>>> position="absolute" left="0" top="0.1">
>>> <fo:block>
>>> <fo:external-graphic border-collapse="separate"
>>> content-height="1in" content-width="1in" display-align="center"
>>> src="ref_scout_3_0_650043924" />
>>> </fo:block>
>>> </fo:block-container>
>>> </fo:block-container>
>>> <fo:block-container width="1.2102857142857144in"
>>> top="3.9297774842857143in" position="absolute" left="0.0in" height="0.6in">
>>> <fo:block linefeed-treatment="preserve" white-space-collapse="false"
>>> font-size="8pt" font-family="StoneSerif">Anterior surface of
>>> patella</fo:block>
>>> </fo:block-container>
>>> <fo:block-container width="1.2102857142857144in"
>>> top="5.698118852857143in" position="absolute" left="0.0in" height="0.6in">
>>> <fo:block linefeed-treatment="preserve"
>>> white-space-collapse="false" font-size="8pt"
>>> font-family="StoneSerif">Patellar tendon</fo:block>
>>> </fo:block-container>
>>> <fo:block-container width="1.2102857142857144in"
>>> top="2.4832606942857147in" position="absolute" left="0.0in" height="0.6in">
>>> <fo:block linefeed-treatment="preserve"
>>> white-space-collapse="false" font-size="8pt"
>>> font-family="StoneSerif">Quadriceps tendon</fo:block>
>>> </fo:block-container>
>>> </fo:table-cell>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>>> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Does fop-1.1 block-container respect "top" attribute?
Posted by Pascal Sancho <ps...@gmail.com>.
Hi,
top is one of the relative position properties, when applied to the
fo:block (see [1] & [2]).
Currently, FOP doesn't implement such properties (see [2]).
I see 2 workaround alternatives:
As Glenn said, you should use absolute ones that come with fo:block-container:
<fo:block-container abolute-position="absolute" top="1in">
<fo:block>...</fo:block>
</fo:block-container>
Or play with space-before property:
<fo:block
space-before="-0.5em"
space-before.conditionality="retain"
>...</fo:block>
[1] http://www.w3.org/TR/xsl/#fo_block
[2] http://www.w3.org/TR/xsl/#common-relative-position-properties
[3] http://xmlgraphics.apache.org/fop/compliance.html#fo-property-commonrelpos-section
2013/8/28 Glenn Adams <gl...@skynav.com>:
> P.S. In the future, don't bother sending the XSLT if your question is
> related to formatting. Only the XSL-FO content is relevant.
>
> P.S.S. Why do you use nested block containers for the first block?
>
>
> On Tue, Aug 27, 2013 at 5:24 PM, Rob Sargent <rs...@xmission.com> wrote:
>>
>> I cannot seem to push a block down using 'top="n"' set to any value n > 0
>> (and < 1 of course)
>>
>> I've even added an extra, enclosing (superfluous?) block-container inside
>> the table-cell. "left" and "right" are working just fine but "top" not so
>> much.
>>
>> I thought this was a compliant piece of FOP. Am I wrong about that or
>> just doing something stupid again. (Hey, I've been away awhile).
>>
>> Thanks.
>>
>> My xsl: this template is called as the table-cell is laid out.
>>
>> <xsl:template name="scout-image">
>> <xsl:param name="curpage"/>
>> <xsl:param name="curpos"/>
>> <xsl:param name="imageCount"/>
>> <xsl:if test="contains($curpage/@layout-id, 'scout') and
>> count($curpage/image[@pos = $imageCount + $curpos]) = 1">
>> <xsl:variable name="scoutsize">
>> <xsl:choose>
>> <xsl:when test="$imageCount = 3">
>> <xsl:value-of select="number(0.9)"/>
>> </xsl:when>
>> <xsl:when test="$imageCount = 1">
>> <xsl:value-of select="number(1.0)"/>
>> </xsl:when>
>> <xsl:otherwise>
>> <xsl:value-of select="number(1.25)"/>
>> </xsl:otherwise>
>> </xsl:choose>
>> </xsl:variable>
>> <fo:block-container>
>> <fo:block-container position="absolute" z-index="-1"
>> height="{$scoutsize}in" width="{$scoutsize}in">
>> <xsl:choose>
>> <xsl:when test="$curpage/@pos mod 2 = 0">
>> <xsl:attribute name="left">
>> <xsl:value-of select="0"/>
>> </xsl:attribute>
>> </xsl:when>
>> <xsl:otherwise>
>> <xsl:attribute name="right">
>> <xsl:value-of select="0"/>
>> </xsl:attribute>
>> </xsl:otherwise>
>> </xsl:choose>
>> <xsl:choose>
>> <xsl:when test="$imageCount = 1">
>> <xsl:attribute name="top">
>> <xsl:value-of select="0.1"/>
>> </xsl:attribute>
>> </xsl:when>
>> <xsl:otherwise>
>> <xsl:attribute name="top">
>> <xsl:value-of select="0"/>
>> </xsl:attribute>
>> </xsl:otherwise>
>> </xsl:choose>
>>
>> <xsl:call-template name="show-image">
>> <xsl:with-param name="img"
>> select="$curpage/image[@pos= $curpos + $imageCount]" />
>> <xsl:with-param name="width" select="$scoutsize" />
>> <xsl:with-param name="height" select="$scoutsize" />
>> <xsl:with-param name="addBlack" select="false()" />
>> </xsl:call-template>
>> </fo:block-container>
>> </fo:block-container>
>> </xsl:if>
>> </xsl:template>
>>
>>
>> My fop:
>> <fo:table-cell>
>> <fo:block-container>
>> <fo:block-container width="1in" height="1in" z-index="-1"
>> position="absolute" left="0" top="0.1">
>> <fo:block>
>> <fo:external-graphic border-collapse="separate"
>> content-height="1in" content-width="1in" display-align="center"
>> src="ref_scout_3_0_650043924" />
>> </fo:block>
>> </fo:block-container>
>> </fo:block-container>
>> <fo:block-container width="1.2102857142857144in"
>> top="3.9297774842857143in" position="absolute" left="0.0in" height="0.6in">
>> <fo:block linefeed-treatment="preserve" white-space-collapse="false"
>> font-size="8pt" font-family="StoneSerif">Anterior surface of
>> patella</fo:block>
>> </fo:block-container>
>> <fo:block-container width="1.2102857142857144in"
>> top="5.698118852857143in" position="absolute" left="0.0in" height="0.6in">
>> <fo:block linefeed-treatment="preserve"
>> white-space-collapse="false" font-size="8pt"
>> font-family="StoneSerif">Patellar tendon</fo:block>
>> </fo:block-container>
>> <fo:block-container width="1.2102857142857144in"
>> top="2.4832606942857147in" position="absolute" left="0.0in" height="0.6in">
>> <fo:block linefeed-treatment="preserve"
>> white-space-collapse="false" font-size="8pt"
>> font-family="StoneSerif">Quadriceps tendon</fo:block>
>> </fo:block-container>
>> </fo:table-cell>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>>
>
--
pascal
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: Does fop-1.1 block-container respect "top" attribute?
Posted by Glenn Adams <gl...@skynav.com>.
P.S. In the future, don't bother sending the XSLT if your question is
related to formatting. Only the XSL-FO content is relevant.
P.S.S. Why do you use nested block containers for the first block?
On Tue, Aug 27, 2013 at 5:24 PM, Rob Sargent <rs...@xmission.com> wrote:
> I cannot seem to push a block down using 'top="n"' set to any value n > 0
> (and < 1 of course)
>
> I've even added an extra, enclosing (superfluous?) block-container inside
> the table-cell. "left" and "right" are working just fine but "top" not so
> much.
>
> I thought this was a compliant piece of FOP. Am I wrong about that or
> just doing something stupid again. (Hey, I've been away awhile).
>
> Thanks.
>
> My xsl: this template is called as the table-cell is laid out.
>
> <xsl:template name="scout-image">
> <xsl:param name="curpage"/>
> <xsl:param name="curpos"/>
> <xsl:param name="imageCount"/>
> <xsl:if test="contains($curpage/@**layout-id, 'scout') and
> count($curpage/image[@pos = $imageCount + $curpos]) = 1">
> <xsl:variable name="scoutsize">
> <xsl:choose>
> <xsl:when test="$imageCount = 3">
> <xsl:value-of select="number(0.9)"/>
> </xsl:when>
> <xsl:when test="$imageCount = 1">
> <xsl:value-of select="number(1.0)"/>
> </xsl:when>
> <xsl:otherwise>
> <xsl:value-of select="number(1.25)"/>
> </xsl:otherwise>
> </xsl:choose>
> </xsl:variable>
> <fo:block-container>
> <fo:block-container position="absolute" z-index="-1"
> height="{$scoutsize}in" width="{$scoutsize}in">
> <xsl:choose>
> <xsl:when test="$curpage/@pos mod 2 = 0">
> <xsl:attribute name="left">
> <xsl:value-of select="0"/>
> </xsl:attribute>
> </xsl:when>
> <xsl:otherwise>
> <xsl:attribute name="right">
> <xsl:value-of select="0"/>
> </xsl:attribute>
> </xsl:otherwise>
> </xsl:choose>
> <xsl:choose>
> <xsl:when test="$imageCount = 1">
> <xsl:attribute name="top">
> <xsl:value-of select="0.1"/>
> </xsl:attribute>
> </xsl:when>
> <xsl:otherwise>
> <xsl:attribute name="top">
> <xsl:value-of select="0"/>
> </xsl:attribute>
> </xsl:otherwise>
> </xsl:choose>
>
> <xsl:call-template name="show-image">
> <xsl:with-param name="img"
> select="$curpage/image[@pos= $curpos + $imageCount]" />
> <xsl:with-param name="width" select="$scoutsize" />
> <xsl:with-param name="height" select="$scoutsize" />
> <xsl:with-param name="addBlack" select="false()" />
> </xsl:call-template>
> </fo:block-container>
> </fo:block-container>
> </xsl:if>
> </xsl:template>
>
>
> My fop:
> <fo:table-cell>
> <fo:block-container>
> <fo:block-container width="1in" height="1in" z-index="-1"
> position="absolute" left="0" top="0.1">
> <fo:block>
> <fo:external-graphic border-collapse="separate"
> content-height="1in" content-width="1in" display-align="center"
> src="ref_scout_3_0_650043924" />
> </fo:block>
> </fo:block-container>
> </fo:block-container>
> <fo:block-container width="1.2102857142857144in"
> top="3.9297774842857143in" position="absolute" left="0.0in" height="0.6in">
> <fo:block linefeed-treatment="preserve" white-space-collapse="false"
> font-size="8pt" font-family="StoneSerif">**Anterior surface of
> patella</fo:block>
> </fo:block-container>
> <fo:block-container width="1.2102857142857144in"
> top="5.698118852857143in" position="absolute" left="0.0in" height="0.6in">
> <fo:block linefeed-treatment="preserve"
> white-space-collapse="false" font-size="8pt" font-family="StoneSerif">**Patellar
> tendon</fo:block>
> </fo:block-container>
> <fo:block-container width="1.2102857142857144in"
> top="2.4832606942857147in" position="absolute" left="0.0in" height="0.6in">
> <fo:block linefeed-treatment="preserve"
> white-space-collapse="false" font-size="8pt" font-family="StoneSerif">**Quadriceps
> tendon</fo:block>
> </fo:block-container>
> </fo:table-cell>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: fop-users-unsubscribe@**xmlgraphics.apache.org<fo...@xmlgraphics.apache.org>
> For additional commands, e-mail: fop-users-help@xmlgraphics.**apache.org<fo...@xmlgraphics.apache.org>
>
>