cocoon-dev mailing list archives

Scott Boag/CAM/Lotus wrote:
> Couldn't you do an xml-based solution? There are ways to do this with
> document()/xsl:key/key(). The syntax may be a little verbose, but at least
> the stylesheet will be interoperable...
>
> -scott
Yeah, I was told this on the mulberry list but didn't get much detail on how
to do this other than that you "can" do it with XSL. I want to be able to
support maybe 10-20 languages based on browser settings. Currently I'm
using xalan extensions by putting tags in like:
<xsl:variable name="language" select="string(/document/@lang)"/>
<xsl:variable name="country" select="string(/document/@country)"/>
<xsl:variable name="locale" select="java:java.util.Locale.new($language,
$country)"/>
<xsl:variable name="bundle"
select="java:java.util.ResourceBundle.getBundle('com.earthtrip.resource.Page
s', $locale)"/>
<xsl:value-of select="java:getString($bundle, '_FIRST_NAME')"/>
which works fine because the ResourceBundle handles all the details about
choosing the correct language bundle based on the locale I set it with at
the top of the page.
Anyone know what the performance difference between a PropertyResourceBundle
and the xsl:key function? Do they both use a hashtable to get access to a
key? If so they are probably similar to each other in access time.
Anyway, I was unable to figure out how to get the document()/xsl:key setup
to work for me. The only documentation I found was the XSLT working document
which got me part way to a solution but I wasn't able to get it to work the
way I needed it to.
Thanks,
Mike