xml-xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ROSSEL Olivier (CIMPA)" <olivier.ros...@airbus.com>
Subject RE: Java mixed with XSLT.
Date Fri, 07 May 2004 08:35:05 GMT
It seems that the type of $s when the matcher is executed is ...
java.lang.Double.
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('a')"/> 
     <xsl:param name="s" select="java:subSequence($e,0,1)"/> 
     <xsl:param name="p"
select="java:java.util.regex.Pattern.compile('\$[0-9a-zA-Z]+')"/> 
     <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 


To
xalan-j-users@xml.apache.org 

cc

Subject
Java mixed with XSLT.

	




I have such a statement: 

     <xsl:param name="e" select="string(@e)"/> 
    <xsl:param name="p"
select="java:util.regex.Pattern.compile('\$[0-9a-zA-Z]+')"/> 
    <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
IllegalArgumentException. 
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
p.matcher(CharSequence) 
exists in the Javadoc. Please note that the method signature precises
"CharSequence" 
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"
select="java:util.regex.Pattern.compile('\$[0-9a-zA-Z]+')"/> 
    <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? 



Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message