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 Problem with a $PARAM in a simple javascript extension
Date Mon, 10 May 2004 13:59:17 GMT

I want to do simple regular expression matching on an attribute value, which
is passed to a javascript extension function as a parameter, but I can't get
it working :-(

The javascript seems to recieve the XPath location of the attribute, rather
than it's value. E.g. "org.apache.xml.utils.NodeVector@ee7a14" instead of

Relevant parts of the XSL:

    <xalan:component prefix="regexp" functions="match">
        <xalan:script lang="javascript">

// JS Regexp
function match(str, re, flags){
    var match = new RegExp(re, flags);
    return match.test(str) +  ", " + str + ", " + re;


    <xsl:template match="text:h|text:p">
            <xsl:attribute name="text:style-name">
                <xsl:call-template name="get-style-name">
                    <xsl:with-param name="STYLE_NAME"
            <xsl:apply-templates select="node()"/>

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


XML fragment:
        <text:p text:style-name="P1">Morality</text:p>

Output fragment:
<text:p text:style-name="false, org.apache.xml.utils.NodeVector@ee7a14,

Expected results:
<text:p text:style-name="true, P1, P\d+">Morality</text:p>

Any help would be most appreciated!


PS: Output of org.apache.xalan.xslt.EnvironmentCheck attached.

David Balch.          | Web developer.
T: +44 (0)1865 286932 | Technology-Assisted Lifelong Learning.
F: +44 (0)1865 286922 | University of Oxford.
E: david.balch@conted.ox.ac.uk

TALL, OUDCE and the University of Oxford accept no legal responsibility for
the contents of this message. Any views or opinions presented are only those
of the author and not those of TALL, or OUDCE, or the University of Oxford.
If this email has come to you in error please delete it and any attachments

View raw message