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

RE: Trouble selecting appropriate node-set depending o

Subject: RE: Trouble selecting appropriate node-set depending on parameters
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 28 Sep 2004 08:40:00 +0100
travis kay
If you give each parameter a default value (on which never occurs in the
data), say

<xsl:param name="PLATFORM" select="'#'"/>

then you can write the corresponding predicate as

/platform[@name=$PLATFORM or $PLATFORM='#']

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

> -----Original Message-----
> From: Travis [mailto:travis@xxxxxxxxxxxxxx] 
> Sent: 28 September 2004 00:26
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Trouble selecting appropriate node-set 
> depending on parameters
> 
> Hi All,
> 
> I'm new to the list and XSL.  So 1st of all, greetings to you 
> all.  I'm
> hoping someone here can point me in the right direction.
> 
> I'm writing a small xsl stylesheet to select a subset of 
> nodes from an xml
> document.  The important part looks like this...
> 
> <xsl:param name="PRODUCTGROUP" />
> <xsl:param name="PLATFORM"  />
> <xsl:param name="ITEM" />
> 
> <xsl:for-each select="/store/productGroup[@type =
> $PRODUCTGROUP]/platform[@type=$PLATFORM]/item[@type=$ITEM]">
> 
> etc..
> 
> 
> What happens is I pass in the values of productgroup, 
> platform and item with
> php.  I can then retrieve a list of all items the attributes 
> of which match
> the criteria.  This seems to work fine, the only trouble is, 
> I'd like in
> some cases to be able to choose all items, regardless of 
> attributes, like
> so...
> 
> <xsl:for-each select="/store/productGroup/platform/item">
> 
> or any combination, like so...
> 
> <xsl:for-each 
> select="/store/productGroup/platform[@type=$PLATFORM]/item">
> 
> I guess I'm a bit unclear how to be able to choose between multiple
> node-sets, depending on the whether or not one of the 
> parameters is set.
> I've been searching for info on this most of the afternoon, 
> but can't seem
> to find much.
> 
> If anyone has any suggestions, I'd be deeply appreciative.
> 
> Thanks!
> 
> -Travis
> 
> 
> 
> 
> 
> 
> 
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.760 / Virus Database: 509 - Release Date: 9/10/2004

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.