[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Need help figuring out how to use exslt in stylesheet


Subject: [xsl] Need help figuring out how to use exslt in stylesheet
From: "Karr, David" <david.karr@xxxxxxxx>
Date: Mon, 31 Oct 2005 15:45:09 -0800

I'm sure something I'm doing is completely misguided, but I'm still
experimenting here.

I'm trying to figure out how to have a stylesheet use the EXSLT library.
I'm also doing this inside Stylus Studio, which might complicate things.

I copied the entire exslt tree to the directory where I have my
stylesheet (probably overkill).  I have an "xsl:import" for
"exslt/str/str.xsl".  I have a root template that calls a sub-template,
passing a parameter.  The sub-template tries to call "str:tokenize" and
put the result into a variable.

When I try to run the test on my sample data, I get an error:

-------
TransformerException: misplaced literal result in a func:function
container.
URL: file:.../exslt/str/functions/tokenize/str.tokenize.function.xsl
Line: 40
Col: 17
-------

Line 40 is the end tag of the "func:function" element defining
"str:tokenize".

I have the processor set to xalan-j 2.5.2.

My xslt is just this:
--------------------
<?xml version='1.0' ?>
<xsl:stylesheet version="1.0"
                xmlns:str="http://exslt.org/str"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
				extension-element-prefixes="str">
	<xsl:import href="exslt/str/str.xsl"/>
	<xsl:template match="/">
		<addressData>
			<complexAddress>
				<xsl:call-template
name="extractAddress">
					<xsl:with-param
name="simpleAddress" select="addressData/simpleAddress"/>
				</xsl:call-template>
			</complexAddress>
		</addressData>
	</xsl:template>
	<xsl:template name="extractAddress">
		<xsl:param name="simpleAddress"/>
		<xsl:variable name="tokens"
select="str:tokenize($simpleAddress)"/>
		<streetAddress>$tokens[0]</streetAddress>
		<city>$tokens[1]</city>
		<state>$tokens[2]</state>
		<zip>$tokens[3]</zip>
	</xsl:template>
</xsl:stylesheet>
----------------


Current Thread
Keywords