Re: [xsl] Reading the values of elements in a complex parameter

Subject: Re: [xsl] Reading the values of elements in a complex parameter
From: David Adams <dpadams@xxxxxxxxx>
Date: Fri, 24 Sep 2004 08:03:20 +1000
> $param/genera/genus[1]
> 
> >      Coturnix
> 
> $param/genera/genus[2]
> 
> >      Philemon
> 
> $param/genera/genus[3]

I'd tried this syntax out yesterday without luck and tried again today
without luck. Perhaps the problem is how I declare the global
parameter?

<xsl:param name="param"/>

When the value of param is a simple string like "foo", no problem.
When it is nested tags, like my example, the processor complains
"expression is not a node set". I've tried putting the value of param
in single quotes but this makes no difference.

> 
> > 2) Using each subelement value as part of a match condition.
> 
> You can't use them in match patterns. Do you mean in xsl:if expressions or in predicates? e.g. /Australian_Birds/Species[Genus_name = $param/genera/genus[1]]

Here's my scenario:
-- There's an XML file with the birds of Australia listed.
-- The XSL transformation's task is to extract birds based on some
conditions and output them. For example, find extinct birds, or only
birds in a particular genus.
-- What I'm trying to do is make the inputs dynamic. For example, so
that the list of genera can have 1 item, 3 items, 5 items...as you
like. I would think anyone coming from a Web+database background would
typically be interested in this sort of approach.

I raised this problem in a different thread and was given three options:
1) Pass in structured parameters and process them. This is what I'm
struggling with and, quite likely, I misunderstood the idea.

2) Pre-process the XSL so that it contains complete match statements
_before_ passing it to the processor. I've been doing this for some
time and it works perfectly.

3) Use an evaluate extension. I don't have access to this in my
production environment.

I feel like I'm swimming upstream so I suspect that either I'm just
too limited in my abilities with XSL or I'm trying to do something XSL
isn't good at. I've been struck by the high level of advice offered on
this list and much appreciate it. I'm not used to depending on the
kindness of strangers for programming advice, so thanks again.

-- 
---------------------------------------------
 David Adams
  dpadams@xxxxxxxxx
 Bermagui 2546 NSW
---------------------------------------------

--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
--+--

Current Thread