[Home] [By Thread] [By Date] [Recent Entries]

Subject: Re: tokenize and split
From: Andy Chambers <achambers.home@xxxxxxxxxxxxxx>
Date: Fri, 6 Feb 2009 14:09:40 +0000
On Fri, Feb 6, 2009 at 12:06 PM, Martin Honnen <Martin.Honnen@xxxxxx> 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

Current Thread
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member