[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

match by arbitrary number of criteria

Subject: match by arbitrary number of criteria
From: "John Horner" <Horner.John@xxxxxxxxxx>
Date: Mon, 4 Jun 2007 16:10:58 +1000
 match by arbitrary number of criteria
I've got XML roughly like this:


Where each item, as you can see, is categorised.

I'm transforming them, using parameters for inclusion and exclusion,
roughly like this:

<xsl:stylesheet version="1.0"
	<xsl:param name="included" select="'Science'"/>
	<xsl:param name="excluded" select="'Politics'"/>
	<xsl:template match="//item">
		<xsl:if test="contains(subjects,$included) and
			<xsl:value-of select="name"/>

Which selects "bar", because its subjects match the included string and
don't match the excluded string.

So, all well and good if I only ever have one of each, but now I need to
add more. What if I might have any number of inclusions and exclusions?
Say I had a config file like this:


Allowing an arbitrary number of inclusions and exclusions, how would I
efficiently test each item?

The information contained in this email and any attachment is confidential
may contain legally privileged or copyright material.   It is intended only
the use of the addressee(s).  If you are not the intended recipient of this
email, you are not permitted to disseminate, distribute or copy this email or
any attachments.  If you have received this message in error, please notify
sender immediately and delete this email from your system.  The ABC does not
represent or warrant that this transmission is secure or virus free.   Before
opening any attachment you should check for viruses.  The ABC's liability is
limited to resupplying any email and attachments

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.