xsl-list
[Top] [All Lists]

Re: [xsl] tokenize and split

2009-02-06 09:10:09
On Fri, Feb 6, 2009 at 12:06 PM, Martin Honnen 
<Martin(_dot_)Honnen(_at_)gmx(_dot_)de> wrote:
Andy Chambers wrote:


Try whether
 <xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
   xmlns:fn="http://www.w3.org/2005/xpath-functions";
   version="1.0">

 ...


         <xsl:choose>
               <xsl:when test="function-available('str:split')">
                 <xsl:copy-of select="str:split('a b c', ' ')[1]"/>
               </xsl:when>
               <xsl:when test="function-available('fn:tokenize')">
                 <xsl:copy-of select="fn:tokenize('a b c', ' ')[1]"/>
               </xsl:when>

works with Xalan.

Thanks Martin,

That works great.  Just in case this comes up in a future search, I did
have to add the "str" namespace too.

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

--
Andy

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

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