xml-xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henry Zongaro <zong...@ca.ibm.com>
Subject RE: Problem with a $PARAM in a simple javascript extension
Date Tue, 18 May 2004 13:22:26 GMT
Hi, David.

David Balch <david.balch@continuing-education.oxford.ac.uk> wrote on 
2004-05-18 04:25:11 AM:
> Does anyone have any ideas about my 
"org.apache.xml.utils.NodeVector@ee7a14"
> problem? Is it a Xalan bug?
> 
> Cheers,
> Dave.
> 
> > -----Original Message-----
> > Hi,
> > 
> > > From: Henry Zongaro [mailto:zongaro@ca.ibm.com]
> > >      I was trying to reproduce your problem, but I'm running 
> > > into problems 
> > > at an early stage (most likely due of my lack of experience 
> > > with extension 
> > > functions).  Could I ask you to post a complete test case?
> > 
> > Reduced testcase attached.
> > 
> > Cheers,
> > Dave.
> > 
> > > Thanks,
> > > 
> > > Henry

     Sorry for not responding earlier.  I'm inclined to view Xalan's 
current behaviour as correct.  The value contained in the STYLE_NAME 
parameter in the following call to the javascript function, match, is a 
node set:

  <xsl:value-of select="regexp:match($STYLE_NAME, 'P\d+')"/>

The semantics of converting a node set to a string within javascript are 
not necessarily well-defined.

     One might be tempted to say that the semantics should be the same as 
those in XPath:  viz., take the first node in the node set, and convert 
that to a string.  However, when we get to XSLT and XPath 2.0, the 
semantics will depend on whether a conversion to string is considered to 
behave as if performed using the fn:string function or using "cast as 
xs:string".  I'd like to forestall any discussion of how to insinuate the 
conversion operations for XPath node sets, result tree fragments (and in 
future, sequences and temporary trees) into the frameworks for other 
scripting languages, and simply say that we won't try.

     If you explicitly cast the value to a string, you get the behaviour I 
believe you expected.

  <xsl:value-of select="regexp:match(string($STYLE_NAME), 'P\d+')"/>

     I hope that helps.

Thanks,

Henry
------------------------------------------------------------------
Henry Zongaro      Xalan development
IBM SWS Toronto Lab   T/L 969-6044;  Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com



Mime
View raw message