[xsl] using variables and attributes to build output tree

Subject: [xsl] using variables and attributes to build output tree
From: Eric Smith <Eric.Smith@xxxxxxxxxxxx>
Date: Tue, 13 Nov 2001 17:39:25 +0100
Hi

I currently use this conditional to determine whether to apply a
template:


  <xsl:template match="sub">
      <xsl:if test=" 
    ( $output='proposal' and ( ancestor::proposal or @proposal)  ) 
    or
    ( $output='executive' and ( ancestor::executive or @executive)  ) 
    or
    ( $output='retail' and ( ancestor::retail or @retail)  ) 
    or 
    $output='full' 
    or 
    ( $output = 'subsidy' and ( ancestor::subsidy or @subsidy ))
    ">

    <fo:block>
    ...
    <apply-templates/>
    ...


This conditional allows user to create nodes with names that
relate to particular outputs.  In addition you can define an
attribute in a selected node with <sub proposal="1">.

However I now want to define attributes more flexibly, so 
I thought three extra attributes viz.
@include
@exclusive
@reject

would fill all conditions we need, but these need to be able
to be lists (not just because they have an '@' for a perl array :)).

so we can then say:
<para @include='executive<some_separator>retail'>
and use xsl regex in the conditional to match any of these.

The other part of my question is how do I establish the above
conditional for all templates but only have it occur once in the xsl
(and not in each template, which is silly).

I tried with a named template but failed.
-- 
Eric Smith - currently xalan and fop on linux

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


Current Thread