This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Generating a list of items NOT present in source XML


Hello all,

   I'm wondering if anyone has created a template (or has ideas on how to 
efficiently create such) that generates a list of items that is missing 
from a given source document.  Assume that a node-set is passed that 
contains an assorted cluster of indices, the template should start at one, 
and continue to the highest provided element, outputting all missing elements.

   For example, the source document:
<root>
   <obj><childnode>3</childnode></obj>
   <obj><childnode>5</childnode></obj>
   <obj><childnode>9</childnode></obj>
   <obj><childnode>5</childnode></obj>
   <obj><childnode>4</childnode></obj>
   <obj><childnode>1</childnode></obj>
   <obj><childnode>7</childnode></obj>
</root>

might produce

<missing>
   <obj><childnode>2</childnode></obj>
   <obj><childnode>6</childnode></obj>
   <obj><childnode>8</childnode></obj>
</missing>

when passed through such a template.

   I figure one way to do this is to first sort the node-set (possibly 
using a parameter to identify the indexed node), and then apply a template 
on all children that don't have an index that is 1 less than that of the 
following sibling.  But there are problems there when there are 2 
consecutively missing nodes.  Any ideas?


Greg Faron
Integre Technical Publishing Co.



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]