This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: 2 Questions: (1) about looping for declaring table columns (2) variable table widths



Thanks for all the helpful responses from all you guys. For my purposes, the
simple recursive algorithm would work fine for now and I intend to move to
the least recursive example given by Dmitro later on. But as was pointed out
by you all earlier, thie simple recursive example crashes. I tried the
example below and looks like my XSLT processor (Xalan) does not like a call
from the "table" template to the "toy-solution" template with a "index"
param being passed in like shown in the example given below by Jarno.
The exact error is:
XSLT Error (javax.xml.transform.TransformerConfigurationException):
xsl:with-param is not allowed in this position in the stylesheet!

Can you call a template by name with a param being passed in xalan? I have
tried many different ways for doing this and they all give me the same error
as above. Also, looked at
http://www.w3.org/TR/WD-xslt#section-Passing-Parameters-to-Templates  Some
of the calls I tried were:
	<xsl:call-template name ="tableColumn" />
		<xsl:with-param name="index" select="@cols" />
	</xsl:call-template>

	<xsl:call-template name ="tableColumn" />
		<xsl:with-param name="index">"@cols"</xsl:with-param>
  	</xsl:call-template>

	<xsl:apply-templates select ="tableColumn" />
		<xsl:with-param name="index" select="@cols" />
	</xsl:apply-templates>

Looking at textbook examples, looks like either of these call should be
valid. Is there some kind of configuration parameter that needs to be
changed in the xalan.jar to allow this call? Since our development effort
has been using Xalan so far, I would rather stick to that rather than change
to Saxon if possible?

Thanks for all your help,

Gagan
> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of
> Jarno.Elovirta@nokia.com
> Sent: Tuesday, August 28, 2001 12:21 AM
> To: xsl-list@lists.mulberrytech.com
> Subject: RE: [xsl] 2 Questions: (1) about looping for declaring table
> columns (2) variable table widths
>
>
> > Q1>>
>
> Hopefully this won't crash your XSLT processor when processing
> the input you
> gave as an example.
>
> <xsl:template match="table">
>   <fo:table space-before.optimum="3pt" space-after.optimum="5pt">
>     <xsl:call-template name="toy-solution">
>       <xsl:with-param name="index" select="@cols" />
>     </xsl:call-template>
>     <fo:table-body>
>       <xsl:apply-templates/>
>     </fo:table-body>
>   </fo:table>
> </xsl:template>
>
> <xsl:template name="toy-solution">
>   <xsl:param name="index" />
>   <xsl:if test="$index">
>     <xsl:call-template name="tableColumn" />
>     <xsl:call-template name="toy-solution">
>       <xsl:with-param name="index" select="$index - 1" />
>     </xsl:call-template>
>   </xsl:if>
> </xsl:template>
>
> > Q2>>
> > Is there a way to get flexible column widths in
> > <fo:table-column> based on
> > the text in the table cell rather than hardcoding in the
> > <fo:table-column>
> > tag? I know fop 0.18.1 does not support that, but do the
> > later versions like
> > fop 0.20.1 have this feature? Any workarounds?
>
> The current CVS version throws you an error message "WARNING: current
> implementation of tables requires a table-column for each column,
> indicating
> column-width". People on the FOP list might be able to help you on the
> workaround - unless you want to implement the automatic table
> layout defined
> in 17.5.2 of the CSS2 specification yourself.
>
> Jarno
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]