Subject: Re: [xsl] Inconsistent solution from a conditional data-set by group methods From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Fri, 20 Apr 2001 12:35:36 +0100 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Inconsistent solution fro, Jeni Tennison | Thread | [xsl] xsi:schemaLocation in target , Ivo Ottiger |
Re: [xsl] Re: Transitive closure fo, Christian Nentwich | Date | [xsl] living headers, Joerg Schmitz |
Month |