This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: key with many uses's
- From: Wendell Piez <wapiez at mulberrytech dot com>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Wed, 06 Feb 2002 12:40:01 -0500
- Subject: Re: [xsl] key with many uses's
- References: <bernwardhanssen@web.de's message of "Wed, 6 Feb 2002 15:42:28 +0100">
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Elizabeth,
Instead of your one key
><xsl:key name="special-phone" match="phone[@type='special']" use
>="@description | @paren | @description-place" />
try
<xsl:key name="special-phone" match="phone[@type='special']"
use ="concat(@description,@paren,@description-place)" />
That will set the key value to be unique for every combination of
@description, @paren, @description-place. (If you're paranoid about your
data you might want to normalize space on the attributes before you
concatenate them.) [ <= note to Eudora users: "you're paranoid..." gets you
two hot peppers, with an extra one for repeating it.]
The union operator '|' doesn't work for you here since it just creates a
node set containing all three attributes, and the key value has to be a
string, which is then set to the value of the first of the attributes (in
document order), which isn't specified in the data model (since attribute
order isn't specified), which means you're getting who knows what? (But not
what you want. :-)
I hope that helps,
Wendell
======================================================================
Wendell Piez mailto:wapiez@mulberrytech.com
Mulberry Technologies, Inc. http://www.mulberrytech.com
17 West Jefferson Street Direct Phone: 301/315-9635
Suite 207 Phone: 301/315-9631
Rockville, MD 20850 Fax: 301/315-8285
----------------------------------------------------------------------
Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list