Re: [xsl] import-apply-param etc?

Subject: Re: [xsl] import-apply-param etc?
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Mon, 30 Apr 2001 09:35:41 +0100
Hi Koray,

> So I figured out, I "import" this standard(first) xsl to a second
> xsl on which I define color and font attributes and so forth.

It sounds as though you want to do the processing in two steps - first
create the (X)HTML, and then add formatting information to that

It's fairly difficult to split those up into two steps in one
stylesheet (although it's fairly easy to do it all in one step in one
stylesheet).  I'd recommend one of the following approaches:

1. forget about adding style information to the HTML with an XSLT
   stylesheet - instead, use CSS to define the style of the HTML that
   you're producing.

2. add the formatting information at the same time as you generate the
   HTML.  In your example, where you want to add a border attribute
   from the source XML to the HTML that you're producing, you could

   <xsl:template match="Table">
      <xsl:value-of select="No"/><br/>
      <xsl:value-of select="Name"/><br/>
      <!-- added border attribute -->
      <table border="{@border}">
         <xsl:apply-templates select="ColumnHeaders"/>
         <xsl:apply-templates select="Rows"/>

3. import your generating stylesheet to the formatting one, and have
   templates that capture the result of applying imports to the node,
   and process the result of that (converting first to a node set with
   exsl:node-set() or similar).
4. perform the transformation in two steps with two separate
   stylesheets - first run the stylesheet to generate the XHTML, and
   then run another stylesheet to add the formatting.  This is made
   more complicated by the fact that you use the same source XML in

The latter two approaches are in fact so complicated that I would
think long and hard before I used them in this situation.  If you
*really* want to use one of them, we can try to work it out, but the
former two approaches are so much easier.

Sorry not to be more help,


Jeni Tennison

 XSL-List info and archive:

Current Thread