You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Arnaud Malguy <Ar...@xps-pro.com> on 2001/03/19 10:24:25 UTC

xsl:key for element in external document

Hi,

I tried tu use xsl:key for element in external document with the
following way :
 <xsl:variable name="ext-doc-root" select="document('file')/ns:root"/>
  <xsl:key name="element" match="$ext-doc-root/ns:element" use="@name"/>

But it don't work. The match pattern seems to be unallowed.
an idea ?

Thank you.

Arnaud Malguy.




Re: xsl:key for element in external document

Posted by Klaus Malorny <Kl...@knipp.de>.
Arnaud Malguy wrote:
> 
> Hi,
> 
> I tried tu use xsl:key for element in external document with the
> following way :
>  <xsl:variable name="ext-doc-root" select="document('file')/ns:root"/>
>   <xsl:key name="element" match="$ext-doc-root/ns:element" use="@name"/>
> 
> But it don't work. The match pattern seems to be unallowed.
> an idea ?
> 
> Thank you.
> 
> Arnaud Malguy.

Yes, you are right. Variables are not allowed in xsl:key elements. I ran into
the same problem recently. Unfortunately, I don't have my XSL book with me,
but, as far as I can remember, one can use this mechanism with documents
loaded with document(). I think the key definition applies to all documents
loaded, including those loaded by document(), but the key() function returns
only those nodes which are in the same document as the current node. In my
case, it had some drawbacks, so I turned back to a pattern not using keys.

regards,
Klaus Malorny