[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

tokenize and split

Subject: tokenize and split
From: Andy Chambers <achambers.home@xxxxxxxxxxxxxx>
Date: Fri, 6 Feb 2009 11:57:56 +0000
 tokenize and split
Hi,

My problem is that I need to make a stylesheet which uses str:split
work on both saxon and
xalan processors.  I understand that saxon's tokenize is similar and
have been able to use it to make the stylesheet work on saxon.
However, I'm having difficulty working out how to use
function-available to invoke saxon's tokenize if it is available
otherwise use the str:split.

So I've got the following...

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

which runs fine in saxon but even though xalan wouldn't have to run
the tokenize function, it still
thinks there's a mistake because it doesn't recognize the function
tokenize.  I think that xalan
would be convinced that everything was OK if tokenize was prefixed by
a namespace.  Is it
possible to assign a namespace to XSLT2 functions so that I could say
something like...

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

Does anyone else have any other ideas?

Cheers,
Andy

-- 
----
Andy Chambers
Formedix Ltd

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.