xsl-list
[Top] [All Lists]

Re: EXSLT

2003-05-09 02:30:06
Hi Johan,

I think the error message is clear. But according to

http://www.exslt.org/str/index.html 

the concat(node-set) should work with EXSLT. 

Why Im trying with concat is that I need the string as a variable 
and not in the output. 

You are trying to use the EXSLT extension function str:concat(), but
because you aren't using the prefix "str:" on your function call, you
are actually using the built-in function concat(). The built-in
function concat() concatenates the two-or-more strings that it is
passed as arguments. The extension function str:concat() from EXSLT
concatenates the values of the nodes in the node set that it is passed
as an argument.

You must declare the prefix for the extension function in the
<xsl:stylesheet> element:

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:str="http://exslt.org/strings";
                extension-element-prefixes="str">
  ...
</xsl:stylesheet>

and then call the function including the "str:" prefix:

<xsl:template match="*">
   <xsl:variable name="allnodename"
                 select="str:concat(ancestor-or-self::*)"/>
   ...
</xsl:template>

Note that this will only work with processors that support
str:concat() (4XSLT and libxslt). Also note that the call
"str:concat(ancestor-or-self::*)" will *not* give you a string
consisting of the *names* of all the ancestors of the current node,
but rather their values. To do get their names, you should use the code:

<xsl:template match="*">
   <xsl:variable name="allnodename">
     <xsl:for-each select="ancestor-or-self::*">
       <xsl:value-of select="name()" />
     </xsl:for-each>
   </xsl:variable>
   ...
</xsl:template>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>