xml-xalan-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Balch <david.ba...@continuing-education.oxford.ac.uk>
Subject RE: Problem with a $PARAM in a simple javascript extension
Date Wed, 19 May 2004 08:56:59 GMT
Hi Henry,

> From: Henry Zongaro [mailto:zongaro@ca.ibm.com]
> 
>      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.  

Yeah, that's what I assumed (assumption being the mother of all screw-ups
:-)

> 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.

That sounds like a good idea to me.

> 
>      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.

Bingo! just what I wanted :-)

Many thanks for your help,
Dave,

> 
> 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