[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Inconsistent solution from a conditional data-set
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|