cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Engelhart <>
Subject XSL/xalan and Localization
Date Sat, 05 Feb 2000 16:40:15 GMT
Since some of the Xalan/Xerces developers are on this list plus a hand full
of other bright folks, I have a question about localization and how xalan
may or may not work with it.

After spending hours working on some XML/XSL pages late into last night, I
realized that the separation of content from style isn't really as well done
as I thought when dealing with localized applications.  Currently to get
localized strings into my web pages, I am using XSP to generate dynamic XML
which is transformed into HTML using XSLT.  I am using the JDK api
ResourceBundle class to handle this localization by calling
where _MY_i18n_STRING is in a properties file called MyResources with the
key/value pair
_MY_i18n_STRING=My Localized Display String

OK - now this does indeed work fine and I can create properties files for
all the languages I would want to use but here's the design problem I have.

To do this I must create relatively bogus (i.e. no meaning) XML nodes using
XSP code like:

    Locale loc = request.getLocale();
    ResourceBundle bundle = ResourceBundle.getBundle("com.earthtrip.MyRes",
    <xsp:attribute name="xml:lang"><xsp:expr>loc</xsp:expr></xsp:attribute>

My question is, doesn't this kind of mix style/content and data?   I mean,
<SUBMIT_BUTTON> doesn't do anything other than allow me to use dynamic
strings inside my XSL by doing something like this:


The language "strings" being used are in my mind really part of the style of
the page.  I'm sure there are instances where the language is more integral
to the data but in this case, clearly it is not. I was thinking it would
make more sense (to me at least) to allow XSL to have either a way of
getting at localized resources during the transformation - something like
<?language-resource type=""?>
    <xsl:value-of select="SUBMIT_BUTTON"/>

and by wrapping the <xsl:value-of> tag inside an i18n it would look up the
approriate resource from the previous PI or something.  I apologize if the
semantics of this suck but I'm pretty new to all this.

Is this not the job of XSL?  I'm OK with what I'm doing but it just doesn't
"feel" like the separation is completely there.


View raw message