Re: [xsl] xsl:key use attribute using string() causes missing all matches except the first one

Subject: Re: [xsl] xsl:key use attribute using string() causes missing all matches except the first one
From: Xiaocun Xu <xiaocunxu@xxxxxxxxx>
Date: Wed, 24 Mar 2004 11:25:53 -0800 (PST)
Thanks.  I found this reference in the XSLT
Programmer's Reference, should have paid more
attention when reading :(

The reason I was using string() in key was that I am
trying to use key grouping with non-existing or empty
elements, in particular when there is no subcell
element.  I realized this does not apply to this case,
since my code generates subcell elements only if there
are something.

thanks,
Xiaocun

--- David Carlisle <davidc@xxxxxxxxx> wrote:
> 
> 
>   I am not sure what is the reason for
>   this, would appreciate if anyone could shed light
> on
>   this behavior.  Example input XML and XSLT below.
> 
> That is the usual behaviour in XPath1 for all string
> valued functions.
> To get a string value from a node set (either
> implicitly or explictly
> using string()) you take the string value of the
> first  node in document
> order.
> 
> You see the same effect in eg
> <xsl:value-of select="cell[@column=4]/subcell"/>
> which would just return teh string value of teh
> first such element
> whereas
> <xsl:copy-of select="cell[@column=4]/subcell"/>
> would return all the elements.
> 
> In this case I think the solution is just to remove
> the string()
> function.
> 
> I don't understand
> 
>   I been using string() in xsl:key use attribute
>   extensively since it allows me to retrieve records
>   using the key value "".
> 
> as this is true whether or not you use string().
> 
> David
> 
> 
> I have had several messages today that have been
> somehow forwarded by
> the list manager with no subject line and a return
> address of
>
xsl-list-return-144-davidc=nag.co.uk@xxxxxxxxxxxxxxxxxxxxxx
> and the original header in the message body.,
> I have added subject lines and corrected to address
> etc by hand.
> 
> 
> -- 
> http://www.dcarlisle.demon.co.uk/matthew
> 
>
________________________________________________________________________
> This e-mail has been scanned for all viruses by Star
> Internet. The
> service is powered by MessageLabs. For more
> information on a proactive
> anti-virus service working around the clock, around
> the globe, visit:
> http://www.star.net.uk
>
________________________________________________________________________
> 


__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

Current Thread