xsl-list
[Top] [All Lists]

RE: processin each element not on a list

2002-10-06 08:26:10
Thanks. Basically everyone is saying to use a key. How do
you approach the problem if you have several sets of choices.
Lets say one set of choices is {A,B,C,D} and the other set is
{X,Y,Z}. Reformulating the source XML a bit, I would like to
process all <item>'s that did not match their respective set
of choices:

<root>
 <objects>
  <object id="1">
   <choices>
    <choice>A</choice>
    <choice>B</choice>
    <choice>C</choice>
    <choice>D</choice>
   </choices>
  </object>
  <object id="2">
   <choices>
    <choice>X</choice>
    <choice>Y</choice>
    <choice>Z</choice>
   </choices>
  </object>
 </objects>
 <items>
  <item id="1"><object id="1">A</object></item>
  <item id="2"><object id="1">X</object></item>
  <item id="3"><object id="2">W</object></item>
  <item id="4"><object id="1">D</object></item>
  <item id="5"><object id="2">B</object></item>
  <item id="6"><object id="2">Y</object></item>
 </item>
</root>

In other words, <item id="2"> should be processed
because its text value "X" is not among the list
of choices for <ojbect id="1">. Likewise, <item id="3"> 
and <item id="5"> should be processed because thier 
text values "W" and "B" are not among the list
of allowed choices.

Is it possible to do this in a generic fashion
with a *fixed* key definition or do I have to have
one key for each set of choices? What I am trying
to do is come up with a key definition and processing
that would accomodate *any* set of choices that
might be found in the source XML file. 

Thanks in advance.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



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