xml-xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joanne Tong <joan...@ca.ibm.com>
Subject RE: Java mixed with XSLT.
Date Fri, 07 May 2004 20:05:29 GMT
oops.. you're right.. my bad.

The problem occurs when the argument is converted from XString to String 
before the method invocation.  The implementation assumes that XString 
must be either String, Object, Character, Boolean, or a number.  Since 
CharSequence is not the first 4, it is converted to a Double.  It should 
be a simple fix in MethodResolver.convert. 
Please open a bug report.  Thanks.

Joanne Tong

"ROSSEL Olivier (CIMPA)" <olivier.rossel@airbus.com> 
05/07/2004 04:35 AM

Joanne Tong/Toronto/IBM@IBMCA, xalan-j-users@xml.apache.org

RE: Java mixed with XSLT.

It seems that the type of $s when the matcher is executed is ... 
Quite strange!
-----Message d'origine-----
De : Joanne Tong [mailto:joannet@ca.ibm.com]
Envoyé : jeudi 6 mai 2004 21:36
À : xalan-j-users@xml.apache.org
Objet : Fw: Java mixed with XSLT.

Can you please create a bug report for this problem.  Remember to attach a 
sample stylesheet, input doc, and expected output. 

When you have something like this: 

     <xsl:param name="e" select="string('1')"/> 
     <xsl:param name="s" select="java:subSequence($e,0,1)"/> 
     <xsl:param name="p" 
     <xsl:param name="m" select="java:matcher($p,$s)"/> 

the internal representation of $s is an XString object.  Before the 
matcher is invoked, the parameter $s is converted to java.lang.String. 
However, the method expects CharSequence resulting in an 
illegalArgumentException.  Ideally, all objects that implement 
CharSequence should be accepted. 

Keep in mind that this bug might be marked as an enhancement.   
According to  http://xml.apache.org/xalan-j/extensions.html#ext-functions, 
there are limitations due to data type mapping.  However, it does not 
specifically state that an interface cannot be properly mapped. 

Joanne Tong

"ROSSEL Olivier (CIMPA)" <olivier.rossel@airbus.com> 
05/05/2004 01:17 PM 


Java mixed with XSLT.

I have such a statement: 
     <xsl:param name="e" select="string(@e)"/> 
    <xsl:param name="p" 
    <xsl:param name="m" select="java:matcher($p,$e)"/> 
This statement is supposed to occur at the beginning of a template 
and retrieve a "e" parameter, then use Java1.4 regexp on it. 
Everything works fine, except the last line which throws an 
That's quite strange because: $p is a Pattern, $e is a String 
(i checked that with the code given at the end of this message) and 
exists in the Javadoc. Please note that the method signature precises 
and $e is a String (which subclasses ClassSequence). 
Here is my working debugging code: 
     <xsl:param name="e" select="string(@e)"/> 
    <xsl:param name="eClass" select='java:getClass($e)'/> 
    <xsl:param name="eClassName" select='java:getName($eClass)'/> 
    <xsl:param name="p" 
    <xsl:param name="pClass" select='java:getClass($p)'/> 
    <xsl:param name="pClassName" select='java:getName($pClass)'/> 
    <xsl:param name="m" select="java:pattern($p)"/> 
    <xsl:param name="mClass" select='java:getClass($m)'/> 
    <xsl:param name="mClassName" select='java:getName($mClass)'/> 
It works fine and returns expected values for everything. 
Any idea? 

View raw message