Loading ...
Sorry, an error occurred while loading the content.

Re: [XSL-FO] Xalan problem with xsl:param

Expand Messages
  • G. Ken Holman
    ... I suspect you have a basic misunderstanding about parameters. They only parameterize either template rules or the entire stylesheet ... they cannot
    Message 1 of 2 , Sep 10, 2002
    • 0 Attachment
      At 2002-09-10 08:29 +0000, splifke wrote:
      >"javax.xml.transform.TransformerException: xsl:param is not allowed
      >in this position in the stylesheet!
      > at org.apache.xalan.processor.StylesheetHandler.error
      >(StylesheetHandler.java:876)
      >
      >This error is produced on code like this (the xsl:param definition in
      >the templates is the problem):
      >
      ><xsl:template match="table">
      > <xsl:if test="caption">
      > <fo:table-caption xsl:use-attribute-sets="table.data.caption">
      > <fo:block start-indent="0em">
      > <xsl:apply-templates select="caption"/>
      > </fo:block>
      > </fo:table-caption>
      > </xsl:if>
      > <fo:table xsl:use-attribute-sets="table.data" >
      > <xsl:param name="frame">

      I suspect you have a basic misunderstanding about parameters. They only
      parameterize either template rules or the entire stylesheet ... they cannot
      parameterize a portion of the stylesheet.

      If you are just trying to set $frame and $rule, then use <xsl:variable>
      which is allowed pretty well anywhere in a template rule.

      ><xsl:template name="table.frame_rules">
      > <xsl:param-variable name="frame"/>
      > <xsl:param-variable name="rule"/>

      These are improperly named XSLT instructions ... they should be <xsl:param>.

      >What I do not understand is how to pass parameters if the previous
      >example is not valid.

      Unfortunately, your example isn't valid.

      >I found similar examples on several sites (for
      >example http://www.xml.com/lpt/a/2001/02/07/trxml9.html).

      I could not find your use of these instructions on that page ... I think
      Bob has it all right on that page, and knowing Bob he would get it right as
      he is good at what he does.

      > On the
      >contrary I found out that the xsl:param tag is only allowed within
      >xsl:stylesheet and xsl:transform.

      I feel you have been misinformed.

      >Does anybody know how I can pass parameters from templates to other
      >templates without producing an invalid xsl-file?

      Check again what Bob has to say ... it looks fine to me.

      I hope this helps.

      ......................... Ken

      --
      Upcoming hands-on in-depth Europe: Sep 18-Sep 20,2002
      XSLT/XPath and XSL-FO North America: Sep 30-Oct 4,2002

      G. Ken Holman mailto:gkholman@...
      Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
      Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995)
      ISBN 0-13-065196-6 Definitive XSLT and XPath
      ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
      ISBN 1-894049-10-1 Practical Formatting Using XSL-FO
      XSL/XML/DSSSL/SGML/OmniMark services, books (electronic, printed),
      articles, training (instructor-live,Internet-live,web/CD,licensed)
      Next public training: 2002-09-11,13,18,19,30,10-03,12-08
    Your message has been successfully submitted and would be delivered to recipients shortly.