473,761 Members | 2,440 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

i18n via XSLT import?

Hi,
I have a documentation tool based on Java and XSLT that I want to add i18n
capability to. There are around 8 stylesheets that process a Source
generated by the Java code and some of the static labels across the
stylesheets are the same.

Ideally I'd like to import a set of variables into each template, and
preferably based on an XSLT parameter (the locale) but this obviously
doesn't work:

<xsl:param name="locale">l ang-en_GB.xslt</xsl:param>
<xsl:import href="$locale"/>

I don't want to define the generic stylesheets as imports from the
language specific ones because then I would have 8 duplicates for each
supported langauge. So is there a suitable mechanism I can use?

Regards,

--
darren@******** ********public* key
davisononline.o rg******0xDD356 B0D

Oct 22 '05 #1
3 1630
(replying to my own post here)

don't know if this is the best way to do this, but I solved it for now by
importing a stylesheet containing only parameter declarations into each of
the other stylesheets. The parameters themselves are set in the Java
code. Seems to work ok.

Regards,

--
darren@******** ********public* key
davisononline.o rg******0xDD356 B0D

Oct 23 '05 #2
Darren Davison wrote:
(replying to my own post here)

don't know if this is the best way to do this, but I solved it for now by
importing a stylesheet containing only parameter declarations into each of
the other stylesheets. The parameters themselves are set in the Java
code. Seems to work ok.

Regards,

A better solution is to make your own xml document containing all
translations, like this:

i18n_en_GB.xml:

<i18n lang="en_GB">
<lang id="help_msg"> Click here if you want help</lang>
<lang id="error_msg" > An error occured</lang>
</i18n>
You can create different translation documents for each language,
now in the xsl you do this

<xsl:variable name="lang" value="'en_GB'"/>
<xsl:param name="i81n" value="document (./i18n_{$lang}.xm l)"/>

And now if you want to put a help_msg somewhere you do:

<xsl:value-of select="$i18n//lang[@id='help_msg']"/>

Understand?
Oct 24 '05 #3
On Mon, 24 Oct 2005 10:56:22 +0200, Tjerk Wolterink wrote:
Understand?


I do. Thanks for the help.
--
darren@******** ********public* key
davisononline.o rg******0xDD356 B0D

Oct 25 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1679
by: Harry Zoroc | last post by:
I would like to treat an xsd Schema file as XML file and to display the targetNamespace and all the imports. That's it. But the following does not work. Why? I did not enter the stylesheet in the xsd file directly but tried to compute the output on the command line e.g. with xalan like: java net.sf.saxon.Transform -o myout.html myschema.xsd myxsltfile.xslt Using Saxon yields no better result. The produced myout.html contains all HTML...
0
1259
by: Laszlo Zsolt Nagy | last post by:
Hello, I wonder if there is a standard for making i18n in Python projects. I have several Python projects that are internationalized. I also have Python packages with i18n. But it is still not clean to me what is the recommended way to do it. Currently, I use a module called 'localization.py' with this code: from i18n_domain import DOMAIN import gettext
1
1483
by: Sonu Kapoor | last post by:
Hi, I would like to use xpath with xslt. I know that this should be possible, but I dont get it ! Here is what I have tried so far: ==================================== my xml file: ====================================
1
4247
by: geoffblanduk_nospam | last post by:
Using Apache Tomcat 5.0.28 I'm having a problem with the xsl:import command. I have several Tomcat running on the same server (they could be different releases of code so can't share resources). An XSLT script is called via a JSP to convert XML to HTML (<xsl:apply nameXml="routesummary" xsl="/xsl/routesummaryheader.xsl" />). This routesummaryheader.xsl script then needs to call another XSLT
21
2543
by: Damian | last post by:
Hi, I'm from an ASP.NET background an am considering making the switch to Python. I decided to develop my next project in tandem to test the waters and everything is working well, loving the language, etc. What I've got is: two websites, one in ASP.NET v2 and one in Python 2.5 (using 4suite for XML/XSLT) both on the same box (Windows Server 2003) both using the same XML, XSLT, CSS
8
3221
by: CptDondo | last post by:
I have a small, embedded app that uses a webserver to serve up pages showing status, etc. Right now all the pages are hard-coded in English. We need to provide multi-lingual support. All of the pages are PHP generated. Ideally, I'd like for the PHP backend to serve up the language based a) the user's locale, and if that is not set, its own locale.
12
11601
by: Chris | last post by:
Hi, Just wondering if anyone out there knows if it is possible to convert a CSV to xml using XSLT? I've seen a lot of examples of xml to CSV, but is it possible to go back the other way? I don't want to have to use some external program or script to parse the csv first if possible
5
2041
by: adelhay | last post by:
Hello, I have a problem trying to internationalize a simple file in Python. the main folder is called "simple" here is the file: hello.py
4
1420
by: Donn Ingle | last post by:
Hi, A soon-to-be happy new year to everyone! I'm 100% new to this i18n lark and my approach so far has been to create a .mo file per module in my app. My thinking was, why load one huge .mo file when a single module only needs a few strings? Since then, it seems, I have made the wrong decision. For example I have module A that imports module B. Each one does this:
0
10111
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9948
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9765
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8770
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7327
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5364
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3446
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2738
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.