Re: [xsl] key declarations (using a sequence constructor)

Subject: Re: [xsl] key declarations (using a sequence constructor)
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 7 Oct 2009 12:38:07 +0100
> Do they just make a string with some kind of separator
> breaking up the attributes?

usually, yes.

> Isn't there a chance of this failing if the character used for the
> separator is used in one or more of the attributes?

In theory, in general, yes, but in practice there are usually characters
that can not be, or extremely unlikley to be, in the attribute. For
example if the attributes are ID they can not have letters that are not
in XML names, for example |, of if the markup is in a general natural
language document it's unlikely to have unassigned private use
characters such as &#x100000; which can be useful as delimiters.

Or of course you can use 2 keys.

<xsl:key match="name"
              use="string-join((@oid, @parent-oid), '|')"/>
key('name',string-join((@oid, ../@oid), '|'))

could be instead:

<xsl:key match="namea" use="@oid"/>
<xsl:key match="nameb" use="@parent-oid"/>
key('namea',@oid) intersect key('nameb',../@oid)


The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 

Current Thread