xsl-list
[Top] [All Lists]

RE: How to test if a value itn't in a nodeset

2005-04-07 08:28:42
<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')."


Your interpretation is wrong.

S1 != S2 is true if there is a pair of nodes from S1, S2 that are not-equal.

To test whether there is no pair that are equal, use not(S1 = S2).

Michael Kay
http://www.saxonica.com/

 

-----Original Message-----
From: Jaime Stuardo [mailto:jstuardo(_at_)security(_dot_)cl] 
Sent: 07 April 2005 15:31
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] How to test if a value itn't in a nodeset


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


--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>