cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject "argument type mismatch" when using fn:replace
Date Wed, 04 Aug 2010 17:07:45 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

All,

I've been using Cocoon 2.1.11 successfully for quite some time, and I'm
trying to add new capabilities to our product. I'm tripping-up when
trying to use fn:replace with a regular expression.

I'm on Debian Lenny with Debian's package-managed version of Sun JRE
1.6.0_20. I'm pretty sure I haven't messed with any of the libraries
that ship with Cocoon (such as Xalan, etc.), so it should be a pretty
stock install. I've packaged my own webapp rather than using the one
that Cocoon can build for you. I can give details of that process if
necessary.

I tried to use <xsl:analyze-string> which gave me a "cannot use
<xsl:analyze-string> here" error, so I tried changing my <xsl:stylesheet
version="1.0"> to <xsl:stylesheet version="2.0"> which fixed that error,
but didn't give me any output.

At any rate, my current stylesheet header looks like this (with
product-specific xmlns declarations removed for brevity:

<?xml version="1.0" ?>

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

Specifically, my original function call attempt is this (trying to
remove a query parameter form a query string):

        <xsl:variable name="fixed-base-url">
          <xsl:value-of select="$base-url" />
          <xsl:text>?</xsl:text>
          <xsl:value-of select="fn:replace($query-string,
'(&amp;)?list_start=[0-9]+', '')" />
        </xsl:variable>

Executing this results in the following error:

java.lang.IllegalArgumentException: argument type mismatch
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at
org.apache.xalan.extensions.ExtensionHandlerJavaPackage.callFunction(ExtensionHandlerJavaPackage.java:404)
	at
org.apache.xalan.extensions.ExtensionHandlerJavaPackage.callFunction(ExtensionHandlerJavaPackage.java:440)
	at
org.apache.xalan.extensions.ExtensionsTable.extFunction(ExtensionsTable.java:222)
	at
org.apache.xalan.transformer.TransformerImpl.extFunction(TransformerImpl.java:473)
	at
org.apache.xpath.functions.FuncExtFunction.execute(FuncExtFunction.java:208)
	at
org.apache.xpath.Expression.executeCharsToContentHandler(Expression.java:313)
	at org.apache.xalan.templates.ElemValueOf.execute(ElemValueOf.java:274)
	at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2400)
	at
org.apache.xalan.transformer.TransformerImpl.transformToRTF(TransformerImpl.java:1988)
        ...
        (let me know if more of the stack trace would be helpful)

I thought I might have some weird kind of data, so I tried something
simpler, just to be sure:

        <xsl:value-of select="fn:replace('abcabc', 'a', 'b')" />

The above gives me the same error. Either commenting-out the entire
<xsl:value-of> element or changing the select to select="''" removes the
error.

As for <xsl:analyze-string>, the following test resulted in no output:

<xsl:analyze-string select="'abcabc'" regex="a">
<xsl:matching-substring>
A
</xsl:matching-substring>
<xsl:non-matching-substring>
<xsl:value-of select="." />
</xsl:non-matching-substring>
</xsl:analyze-string>

... while I would have expected "AbcAbc" to be emitted. Perhaps I am
misusing the <xsl:analyze-string> element.

Can anyone offer any suggestions?

Thanks,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxZnmEACgkQ9CaO5/Lv0PCGcQCdGI9nhuNAXvbvtAB7ehA7KEiL
YAcAnA2af9MV5hobIKGf21d8dzBGRxw1
=wxjf
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message