[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Using a pre-processor for dynamic inputs


Subject: Re: [xsl] Using a pre-processor for dynamic inputs
From: David Adams <dpadams@xxxxxxxxx>
Date: Fri, 24 Sep 2004 07:51:19 +1000

On Sat, 11 Sep 2004 10:21:38 +0100, Michael Kay <mhk@xxxxxxxxx> wrote:
> There are three approaches to this problem [readining dynamic inputs], all of which are quite
> respectable and widely used.
> 
> (a) if the inputs are fairly predictable in structure, you can write your
> stylesheet to interpret the inputs. For example, you might supply a
> parameter to the stylesheet of the form:
> 
> <conditions>
>   <condition>
>     <attribute>name</attribute>
>     <value>robin</value>
>   </condition>
>   <condition>
>     <attribute>size</attribute>
>     <value>small</value>
>   </condition>
> </conditions>
> 
> and then write logic in your stylesheet to select all the birds that satisfy
> all the conditions.

I'd like to take this approach but am completely stumped at how to
process the input. How is it possible to use subelement values as
dynamic inputs in match/select statements? I keep reading it is
impossible. In my case, the input could looke like this:

<genera>
  <genus>Dromaius</genus>
  <genus>Coturnix</genus>
  <genus>Philemon</genus>
 </genera>

> (b) you can generate or modify the stylesheet each time it is used, to
> incorporate the specific conditions
Yes, pre-processing works great.

> > (c) you can use an extension xx:evaluate(), available in many XSLT
> processors, to intpret an XPath expression that's constructed dynamically.
In my case, I'm using an environment that embeds Xalan C++ 1.6 and
don't have access to evaluate.

Many thanks in advance for suggestions. I'm getting the felling I'm
suffering from thinking in the wrong language. Still, it's hard to
believe that reading dynamic inputs would be an incredibly common task
in XSLT. It also seems that supplying XML structures as inputs should
be quite natural. Perhaps I'm missing some fundamental concept here.
Perhaps the problem is that I'm not looking at the stylesheet aspect
of XSLT. I'm only interested in the transformational aspect and the
native querying abilities.


Current Thread
Keywords