You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Michael Engelhart <me...@navigatus.com> on 2002/05/23 17:06:01 UTC

Escaping and ResourceBundle's

Hi,

I have a web application that uses ResourceBundle.getString() in both JSP's
and in XSL transforms to display site content.   I've run into a situation
where I am using a Xalan extensions to access the ResourceBundles and simple
template to get the strings:


    <xsl:template name="i18n">
        <xsl:param name="key" />
        <xsl:value-of select="java:getString($i18nBundle, $key)"
disable-output-escaping="yes"/>
    </xsl:template>


In my ResourceBundle's I have to use escaped entities to display things like
umlauts and other foreign characters.   This works fine in JSP's as the
output is HTML and for elements in my stylesheets it works fine. For
example, this does the correct thing with escaped entities in the resource
bundles:

<searchtitle>
<xsl:call-template name="i18n">
     <xsl:with-param name="key">_REFINE_YOUR_SEARCH</xsl:with-param>
</xsl:call-template>
</searchtitle>

But when I do the exact same thing with an attribute, it escapes the & into
&amp; and the outputted HTML looks bogus:

This does NOT work:

<input type="button" name="myName">
    <xsl:attribute name="value">
        <xsl:call-template name="i18n">
          <xsl:with-param name="key">_REFINE_YOUR_SEARCH</xsl:with-param>
        </xsl:call-template>
    </xsl:attribute>
</searchtitle>
</input>

I seem to only notice this with <input type="button"> and using
<xsl:attribute> to set the value but it could be true with any attribute.
When researching this, I saw lots of people talking about escaping of HREF's
but that's not my problem - that I understand is part of the spec but the
VALUE attribute of an <input> tag shouldn't be escaped if
disable-output-escaping is turned on should it??

Anyway if this IS the behaviour of Xalan, is there a workaround?  I'm using
JDK 1.3.1 on Mac OS X (although deployed on Linux/JDK 1.3.1 and still
doesn't work) with Xalan 2.2.x

Thanks for any help

Mike Engelhart