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 Léa Massiot <lm...@orange.fr> on 2012/06/08 14:28:00 UTC

Set the padding for all the cells of a given table at once

Hi,

I was wondering if there is another way than the one below to set the
padding for all the cells of a given table at once.

I created an "attribute-set":

<xsl:attribute-set name="foCellAttributeSet">
	<xsl:attribute name="padding-right">2mm</xsl:attribute>
	<xsl:attribute name="padding-left">2mm</xsl:attribute>
	<xsl:attribute name="padding-top">2mm</xsl:attribute>
	<xsl:attribute name="padding-bottom">2mm</xsl:attribute>
</xsl:attribute-set>

and I associated it to each cell of the table:

<fo:table-cell xsl:use-attribute-sets="foCellAttributeSet">
	[...]
</fo:table-cell>

Is it the proper way to do that?

Thank you and best regards.
-- 
View this message in context: http://old.nabble.com/Set-the-padding-for-all-the-cells-of-a-given-table-at-once-tp33981242p33981242.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Set the padding for all the cells of a given table at once

Posted by Léa Massiot <lm...@orange.fr>.
Hi Pascal,
Thank you for your answer.
Ok for the first part of it.
I'll have to work further to catch the meaning of the second :)
Best regards.
-- 
View this message in context: http://old.nabble.com/Set-the-padding-for-all-the-cells-of-a-given-table-at-once-tp33981242p33992902.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Set the padding for all the cells of a given table at once

Posted by Pascal Sancho <ps...@gmail.com>.
Hi Léa,

2012/6/11 Léa Massiot <lm...@orange.fr>:
>
> Hello Pascal,
>
> I'm sorry to come back on this but I do not understand your example... :/
>
> My underlying question is the following: what is the proper method which can
> be used to associate a set of traits with specific values to a given "fo"
> element.
> For example here:
> associate a 2mm top, bottom, left and right padding to
> a particular cell (<fo:cell>) in a particular table (<fo:table>).
>
> With CSS and HTML, we would:
> - declare a class C in a css stylesheet,
> - in which we would set the various paddings
> - and we would set the "class" attribute of a particular <td class="C">
> element in a particular <table> element using this C value as forementioned.
>
> The solution I proposed in my first post does this trick: I reckon the logic
> is the same as above (in the CSS case).
> Yet, you said this is not the more appropriate solution and you proposed
> another one...

No, I said that if attributes values depend on context, the
call-template solution is more appropriate.
attribute-set remains an good solution to factorise static attribute values.

> In this other solution you proposed, I do not understand what this
> <myElement> element is.
> What am I supposed to replace it with?
> Where does this element have to be declared?

<myElement> can be replaced with any XML element you want. As I said,
that thread is a pure XSLT question, and I provide an answer that can
be used in any XSLT context.
XSL-FO can be replaced with any other DTD, the proposed example can be
adapted in any case.

> Note that I do not want ALL the <fo:cell> cells in the document to have
> these styles applied uniformly, I want only some specific cells I choose to
> have these styles applied.
>
> I want my code to be writen properly but as you see I'm confused with your
> example...
>
> Thank you for helping.
> Best regards.


-- 
pascal

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Set the padding for all the cells of a given table at once

Posted by Léa Massiot <lm...@orange.fr>.
Hello Pascal,

I'm sorry to come back on this but I do not understand your example... :/

My underlying question is the following: what is the proper method which can
be used to associate a set of traits with specific values to a given "fo"
element.
For example here:
associate a 2mm top, bottom, left and right padding to
a particular cell (<fo:cell>) in a particular table (<fo:table>).

With CSS and HTML, we would:
- declare a class C in a css stylesheet,
- in which we would set the various paddings
- and we would set the "class" attribute of a particular <td class="C">
element in a particular <table> element using this C value as forementioned.

The solution I proposed in my first post does this trick: I reckon the logic
is the same as above (in the CSS case).
Yet, you said this is not the more appropriate solution and you proposed
another one...
In this other solution you proposed, I do not understand what this
<myElement> element is.    
What am I supposed to replace it with?
Where does this element have to be declared?

Note that I do not want ALL the <fo:cell> cells in the document to have
these styles applied uniformly, I want only some specific cells I choose to
have these styles applied.

I want my code to be writen properly but as you see I'm confused with your
example...

Thank you for helping.
Best regards.
-- 
View this message in context: http://old.nabble.com/Set-the-padding-for-all-the-cells-of-a-given-table-at-once-tp33981242p33992338.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Set the padding for all the cells of a given table at once

Posted by Pascal Sancho <ps...@gmail.com>.
Léa,

here is an example:

<myElement>
  <xsl:call-template name="myAttributeSet">
    <xsl:with-param name="myParam">
      myParamValue
    </xsl:with-param>
  </xsl:call-template>
  ...
</myElement>

<xsl:template name="myAttributeSet">
  <xsl:param name="myParam"/>
  <xsl:attribute name="myAttribute">
    <xsl:value-of select="$myParam"/>
  </xsl:attribute>
</xsl:template>

2012/6/8 Léa Massiot <lm...@orange.fr>:
>
> Hi and thank you for your answer, Pascal.
>
>
> This is a pure XSLT related question.
> Ok, but these are still "fo:cell" elements I'm manipulating... :)
>
> So, you are mentioning yet another more appropriate method than the one I
> used.
> Could you be so very kind to reformulate my example using this other method?
> I don't see how this could be done.
>
> Thank you for helping and best regards.

-- 
pascal

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Set the padding for all the cells of a given table at once

Posted by Léa Massiot <lm...@orange.fr>.
Hi and thank you for your answer, Pascal.


This is a pure XSLT related question.
Ok, but these are still "fo:cell" elements I'm manipulating... :)

So, you are mentioning yet another more appropriate method than the one I
used.
Could you be so very kind to reformulate my example using this other method?
I don't see how this could be done.

Thank you for helping and best regards.
-- 
View this message in context: http://old.nabble.com/Set-the-padding-for-all-the-cells-of-a-given-table-at-once-tp33981242p33981535.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Set the padding for all the cells of a given table at once

Posted by Pascal Sancho <ps...@gmail.com>.
Hi,

This is a pure XSLT related question.
That said, there are usually 2 ways to "repeat" attributes over a
collection of elements:
 - either the one you described
 - or using a xsl:call-template.

The latter is more appropriate if you need to pass parameters to your attributes

2012/6/8 Léa Massiot <lm...@orange.fr>:
>
> Hi,
>
> I was wondering if there is another way than the one below to set the
> padding for all the cells of a given table at once.
>
> I created an "attribute-set":
>
> <xsl:attribute-set name="foCellAttributeSet">
>        <xsl:attribute name="padding-right">2mm</xsl:attribute>
>        <xsl:attribute name="padding-left">2mm</xsl:attribute>
>        <xsl:attribute name="padding-top">2mm</xsl:attribute>
>        <xsl:attribute name="padding-bottom">2mm</xsl:attribute>
> </xsl:attribute-set>
>
> and I associated it to each cell of the table:
>
> <fo:table-cell xsl:use-attribute-sets="foCellAttributeSet">
>        [...]
> </fo:table-cell>
>
> Is it the proper way to do that?
>
> Thank you and best regards.
> --
> View this message in context: http://old.nabble.com/Set-the-padding-for-all-the-cells-of-a-given-table-at-once-tp33981242p33981242.html
> Sent from the FOP - Users mailing list archive at Nabble.com.

-- 
pascal

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org