xsl-list
[Top] [All Lists]

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

2004-03-24 12:25:53
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(_at_)nag(_dot_)co(_dot_)uk> 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[(_at_)column=4]/subcell"/>
which would just return teh string value of teh
first such element
whereas
<xsl:copy-of select="cell[(_at_)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(_dot_)co(_dot_)uk(_at_)lists(_dot_)mulberrytech(_dot_)com
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

________________________________________________________________________


--+------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
You are subscribed as: xiaocunxu(_at_)yahoo(_dot_)com
To unsubscribe, go to:

http://lists.mulberrytech.com/unsub.php/xsl-list/xiaocunxu(_at_)yahoo(_dot_)com
or e-mail:

<mailto:xsl-list-unsubscribe-xiaocunxu=yahoo(_dot_)com(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--



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