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 Mon, 10 May 2004 09:03:07 GMT
Saxon7 :(
 
-----Message d'origine-----
De : Hall, Joe [mailto:Joe.Hall@Avnet.com]
Envoyé : vendredi 7 mai 2004 16:03
À : xalan-j-users@xml.apache.org
Objet : RE: Java mixed with XSLT.


I have a similar problem.  I want to pass the returned result of a template
to Java.
 
The data I get on the Java side is garbled.
 
          <xsl:variable name="something">
               <xsl:call-template name="filter-row"/>
          </xsl:variable>
          <xsl:variable name="nothing"
select="java:TestEXT.setSomething($something)"/>
 
Any suggestions?
 
Thanks,
 
Joe Hall


-----Original Message-----
From: ROSSEL Olivier (CIMPA) [mailto:olivier.rossel@airbus.com]
Sent: Friday, May 07, 2004 4:35 AM
To: 'Joanne Tong'; xalan-j-users@xml.apache.org
Subject: RE: Java mixed with XSLT.


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