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: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 24 Mar 2004 16:52:23 GMT
  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
________________________________________________________________________

Current Thread