[xsl] How to test if a value itn't in a nodeset

Subject: [xsl] How to test if a value itn't in a nodeset
From: "Jaime Stuardo" <jstuardo@xxxxxxxxxxx>
Date: Thu, 7 Apr 2005 10:31:05 -0400
Hi all...

If I have this xml

<doc>
  <valid_combination>
    <ROW>
      <CAD>a</CAD>
      <COB>b</COB>
    </ROW>
    <ROW>
      <CAD>a</CAD>
      <COB>c</COB>
    </ROW>
    <ROW>
      <CAD>b</CAD>
      <COB>d</COB>
    </ROW>
  </valid_combination>
  <current_values>
    <ROW>
      <COB>b</COB>
	<DESC>d1</DESC>
    </ROW>
    <ROW>
      <COB>e</COB>
	<DESC>d2</DESC>
    </ROW>
    <ROW>
      <COB>f</COB>
	<DESC>d3</DESC>
    </ROW>
    <ROW>
      <COB>c</COB>
	<DESC>d4</DESC>
    </ROW>
    <ROW>
      <COB>d</COB>
	<DESC>d5</DESC>
    </ROW>
  </current_values>
</doc>

where CAD field is used to group mutually exclusive elements of current_value
set, for instance, that means that I have to show 2 listings of elements of
the current_values group. The first listing has to show these COB's: b, e, f,
c ("d" is missing because "d" is mutually exclusive with "b" and "c" according
to valid_combination configuration). The second listing has to show these
COB's: e, f, d.

If I use this XSLT:

<xsl:apply-templates select="current_values/ROW[COB = //valid_combination[CAD
= 'a']/COB]" />
<xsl:apply-templates select="current_values/ROW[COB = //valid_combination[CAD
= 'b']/COB]" />

It show:s
1 list.- "b" and "c"
2 list.- "d"

But I need to do the union with the other elements, not present in
valid_combination group. I tried, for example for the first listing:

<xsl:apply-templates select="current_values/ROW[COB = //valid_combination[CAD
= 'a']/COB] | current_values/ROW[COB != //valid_combination/COB]" />

But it didn't work. I interpret that union as:
"show elements of 'current_values' where their COB is present in
'valid_combination' under CAD = 'a' category (to include 'b' and 'c'), plus
the elements where COB isn't in 'valid_combination' (to include only 'e' and
'f', not 'c')."

That is the simplified scenario what I'm trying to achieve.

Any help would be greatly appreciated.

Thanks in advance
Jaime

Current Thread