Reputation: 410
I have some static xsl to translate dynamic xml into html to response to browser. The rest of the web pages use Spring MVC for view. So they can be localized by using Spring's messages.properties file written in my language. But I don't know how to localize the text nodes in the static xsl using the same method. More specific below.
In Spring's web page, I can
<title><spring:message code="title.MyTitle"/></title>
In my static xsl, I have
<xsl:stylesheet ........
<xsl:output method="html"/>
<xsl:template match="/">
.....
<title>My Title</title>
and I want something like this
<xsl:stylesheet ........
<xsl:output method="html"/>
<xsl:template match="/">
.....
<title><spring:message code="title.MyTitle"/></title>
Of course the above doesn't work. But I hope I can keep all titles and labels in messages.properties for easy changes between languages. How can I do this? Please help.
Upvotes: 0
Views: 316
Reputation: 8068
Jirka Kosek has a technique for doing l10n lookups at http://www.xml.com/pub/a/2003/11/05/xslt.html. I thought he'd made a whole system for doing l10n with XSLT, but I can't find that now.
Separately, if your properties files are text rather than the XML property file format that Java also understands, the general technique would be:
unparsed-text()
to get the text of the properties file/
, that is)All that's done so far is mimic the XML property file format.
Upvotes: 1