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

Subject: RE: [xsl] Reading the values of elements in a complex parameter
From: <Jarno.Elovirta@xxxxxxxxx>
Date: Thu, 23 Sep 2004 07:52:33 +0300
Hi,

> I'm struggling to understand how to read complex external parameters.
> Simple parameters are easy enough to work with, but I'm not clear on
> the mechanics of extracting value from complex parameters for value-of
> or within XPath expressions (select.) As in my post of last week, I'm
> trying to feed in a list of values for matching and processing. As an
> example, a very reduced sample of a source XML file with the birds of
> Australia:
>
> <Australian_Birds>
>        <Species>
>                <Sequence>1</Sequence>
>                <Family_Name>Struthionidae</Family_Name>
>                <Genus_Name>Struthio</Genus_Name>
>                <Species_Name>camelus</Species_Name>
>                <Common_Name>Ostrich</Common_Name>
>                <Extinct>False</Extinct>
>        </Species>
>        <Species>
>                <Sequence>2</Sequence>
>                <Family_Name>Casuariidae</Family_Name>
>                <Genus_Name>Casuarius</Genus_Name>
>                <Species_Name>casuarius</Species_Name>
>                <Common_Name>Southern Cassowary</Common_Name>
>                <Extinct>False</Extinct>
>        </Species>
> ...
>
> The parameter  could look like this:
>
> <genera>
>  <genus>Dromaius</genus>
>  <genus>Coturnix</genus>
>  <genus>Philemon</genus>
> </genera>

Let's call this $param

> I want to figure out the syntax for two tasks:
> 1) Reading and using the value of the subelements:
>      Dromaius

$param/genera/genus[1]

>      Coturnix

$param/genera/genus[2]

>      Philemon

$param/genera/genus[3]

> 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]]

If I answered the wrong questions, please give an example of what you want as
a result.

Cheers,

Jarno - Lisa Lashes: Hard Mix

Current Thread