Conditional actions in XSL?

Henry Thompson ht at cogsci.ed.ac.uk
Wed Jan 28 14:12:04 GMT 1998


How to filter children by processing in XSL:

It's not as clean as we would like as things stand.  The following
(untested) is messy but should work with XSLJ:

<define-script>
 var thresholdDate="1/1/94";
 function myFilterPred(node) {
   return dateGreater(node.entrydate,thresholdDate);
 };
 function dateGreate(d1,d2) {
 . . .
 }
</define-script>

<rule>
  . . . some pattern . . .
  <eval>if (myFilterPred(this)) {
          return withMode(OK,processNodeList(this));
        }
        else {
          return <empty/>;
        };
  </eval>
</rule>

<rule mode='OK'
  . . . same pattern . . .
  ... action to format the nodes which are passed by the filter ...

ht
-- 
Henry S. Thompson, Human Communication Research Centre, University of Edinburgh
      2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
               Fax: (44) 131 650-4587, e-mail: ht at cogsci.ed.ac.uk  
                      URL: http://www.cogsci.ed.ac.uk/~ht/

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list