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

Re: Inconsistent solution from a conditional data-set

Subject: Re: Inconsistent solution from a conditional data-set by group methods
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Fri, 20 Apr 2001 12:35:36 +0100
conditional data
Hi Sun-fu,

> Thanks for your prompt attention on my question,
> I should like to use your suggestion,  which is 
>
>    /docs/line[substring(salesno,10,2)='03']
>              [salesno = key('Listing2',name)[1]/salesno]
>
> however  I am  reluctant to use it in general , because 
> Listing2 key function  has to be used  with a hard-wired predicate   for
> the month =3,
> <xsl:key name="Listing2" match="line[substring(salesno,10,2)='03']"
> use="name"/>

Ahh, good point.

>  I hope I  can use Listing2 key function with a global param 
> something like as 
>  <xsl:param name="month" select="'03'"/>
> <xsl:key name="Listing2" match="line[substring(saleno,10,2)=$month"
> use="name"/>
> (which I know I can not do it)

Yup.

> Could you offer an alternative to what I am trying to achieve to
> obtain a list of name for any given month without writing down list
> of Listing key function for various month specification??

Sure.  Define your key in the general way, to index all the lines:

<xsl:key name="Listings" match="line" use="name" />

But then, when you're retrieving the nodes from the key, rather than
getting just the first one of those nodes, filter them first to only
include the ones you're interested in.  So:

  /docs/line[substring(salesno, 10, 2) = $month]
            [salesno = key('Listings', name)
                          [substring(salesno, 10, 2) = $month][1]
                          /salesno]

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



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


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.