I'm OK with this if Gary is.

-scott




                                                                                       
                            
                    Erwin Bolwidt                                                      
                            
                    <[EMAIL PROTECTED]        To:     <[EMAIL PROTECTED]>            
                            
                    g>                   cc:     (bcc: Scott Boag/CAM/Lotus)           
                            
                                         Subject:     Mangling hyphen characters in 
extension elements and         
                    07/05/2001           functions                                     
                            
                    02:35 PM                                                           
                            
                    Please                                                             
                            
                    respond to                                                         
                            
                    xalan-dev                                                          
                            
                                                                                       
                            
                                                                                       
                            




Hello,

I have made a patch that will allow you to write Java extension
functions for the xpath engine, as well as extension elements, that have a
- character in their name. (Hyphens are notallowed in java method names)
When the extension function is implemented in Java, then before selecting
the java method name, the hyphen characters are removed and the letter
following them is uppercased.

This allows you to call a function to-string($object) in xpath,
which results in a call to the toString() method in Java. Or
has-sames-nodes instead of hasSameNodes.

It is of course completely syntactic sugar, but it seems that in the XML
world it is common to use hyphens where Java uses upper-case.

The XT engine does the same with extension functions.

An example:

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:date="xalan://java.util.Date">
<xsl:template match="/">
  <out>
    <xsl:value-of select="date:to-string(date:new())"/>
  </out>
</xsl:template>

</xsl:stylesheet>

Attached to this e-mail is the patch.
Is this nice to have in Xalan?

Best,
  Erwin Bolwidt

P.s. I sent this earlier from an e-mail address that isn't subscribed to
this list. Is it safe to assume that this list ignores e-mails from
non-subscribers?




Reply via email to