Greetings.
I would like to produce a static multilingual website in XHTML. Is it
possible to specify each web page in its own XML file, but have all of the
translations encapsulated in that one file, and then process each XML file
to generate separate language-variant XHTML files?
For example, say we have a file foo.xml which contains, in part, something
like the following:
<body>
<h1>
<only lang="de">Guten Tag!</only>
<only lang="en">Hello !</only>
<only lang="hu">Jó napot kivánok!</only>
<only lang="fr">Bonjo ur!</only>
</h1>
</body>
I want to be able to run some simple command-line utility which will
automatically generate four separate XHTML files foo.de.html, foo.en.html,
foo.hu.html, and foo.fr.html, containing, respectively,
<body>
<h1>
Guten Tag!
</h1>
</body>
<body>
<h1>
Hello!
<h1>
</body>
And so on.
If this is possible, how do I go about doing this, and what software do I
need? (I am running a GNU/Linux system.)
Regards,
Tristan
--
_
_V.-o Tristan Miller [en,(fr,de,ia)] >< Space is limited
/ |`-' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= <> In a haiku, so it's hard
(7_\\ http://www.nothingisreal.com/ >< To finish what you 4 1972
Tristan Miller wrote: Greetings.
I would like to produce a static multilingual website in XHTML. Is it possible to specify each web page in its own XML file, but have all of the translations encapsulated in that one file, and then process each XML file to generate separate language-variant XHTML files?
For example, say we have a file foo.xml which contains, in part, something like the following:
[snip]
I want to be able to run some simple command-line utility which will automatically generate four separate XHTML files foo.de.html, foo.en.html, foo.hu.html, and foo.fr.html, containing, respectively,
[snip]
And so on.
If this is possible, how do I go about doing this, and what software do I need? (I am running a GNU/Linux system.)
Use XSLT.
--
Anne van Kesteren
<http://www.annevankest eren.nl/>
Tristan Miller wrote: I would like to produce a static multilingual website in XHTML. Is it possible to specify each web page in its own XML file, but have all of the translations encapsulated in that one file, and then process each XML file to generate separate language-variant XHTML files?
For example, say we have a file foo.xml which contains, in part, something like the following:
<body> <h1> <only lang="de">Guten Tag!</only> <only lang="en">Hello !</only> <only lang="hu">Jó napot kivánok!</only> <only lang="fr">Bonjo ur!</only>
I suggest to use e.g.
<only xml:lang="de">
as the xml:lang attribute is the way the XML standards suggest the
language of an element's content should be specified.
I want to be able to run some simple command-line utility which will automatically generate four separate XHTML files foo.de.html, foo.en.html, foo.hu.html, and foo.fr.html, containing, respectively,
<body> <h1> Guten Tag! </h1> </body>
If this is possible, how do I go about doing this, and what software do I need? (I am running a GNU/Linux system.)
Transforming XML files is easily done with XSLT, there are several XSLT
processors implemented in Java, some of which have command line
interfaces, for instance Saxon: http://saxon.sourceforge.net/
Of course you need an XSLT stylesheet that takes the language as a
parameter, for instance the following XSLT stylesheet just copies all
nodes besides <only> element nodes for which only the content is copied
if the xml:lang attribute matches the outputLanguage parameter:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8" />
<xsl:param name="outputLan guage" select="'en'" />
<xsl:template match="only[lang($outputLan guage)]">
<xsl:apply-templates select="node()" />
</xsl:template>
<xsl:template match="only" />
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
The stylesheet is set to produce HTML output but if needed it can also
produce XHTML.
Followup-To comp.text.xml
--
Martin Honnen http://JavaScript.FAQTs.com/
Greetings.
In article <3f********@ola f.komtel.net>, Martin Honnen wrote: Of course you need an XSLT stylesheet that takes the language as a parameter, for instance the following XSLT stylesheet just copies all nodes besides <only> element nodes for which only the content is copied if the xml:lang attribute matches the outputLanguage parameter:
OK, so I take it, then, that XSLT by default can't specify different output
streams, and that I would need to use a shell script to invoke the XSLT
processor on the stylesheet and source file n separate times (i.e., once
for each output language). Correct?
Thanks for the sample stylesheet; this is pretty much the sort of example I
was looking for to help get me started.
Regards,
Tristan
--
_
_V.-o Tristan Miller [en,(fr,de,ia)] >< Space is limited
/ |`-' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= <> In a haiku, so it's hard
(7_\\ http://www.nothingisreal.com/ >< To finish what you
Tristan Miller wrote: In article <3f********@ola f.komtel.net>, Martin Honnen wrote:
Of course you need an XSLT stylesheet that takes the language as a parameter, for instance the following XSLT stylesheet just copies all nodes besides <only> element nodes for which only the content is copied if the xml:lang attribute matches the outputLanguage parameter:
OK, so I take it, then, that XSLT by default can't specify different output streams, and that I would need to use a shell script to invoke the XSLT processor on the stylesheet and source file n separate times (i.e., once for each output language). Correct?
With XSLT 1.0 you can't have different output streams and you would
indeed have to call the XSLT processor on the stylesheet and the source
file passing in the the language as a parameter and do that for each
language.
However some processors (like Saxon for instance) have extensions to
produce multiple output files in one pass.
--
Martin Honnen http://JavaScript.FAQTs.com/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Michele Simionato |
last post by:
What is the recommended way of generating HTML from Python? I know of
HTMLGen and of
few recipes in the Cookbook, but is there something which is more or
less standard?
Also, are there plans to include a module for HTML generation in the
standard library?
I really would like to see some standardization in this area.
Michele Simionato
|
by: Tristan Miller |
last post by:
Greetings.
I would like to produce a static multilingual website in XHTML. Is it
possible to specify each web page in its own XML file, but have all of the
translations encapsulated in that one file, and then process each XML file
to generate separate language-variant XHTML files?
For example, say we have a file foo.xml which contains, in part, something
like the following:
|
by: The Bicycling Guitarist |
last post by:
My web site has not been spidered by Googlebot since April 2003. The site in
question is at www.TheBicyclingGuitarist.net/ I received much help from this
NG and the stylesheets NG when updating the code before then.
My host's tech guy just sent me the following. Isn't it okay to specify
UTF-8 as the charset in the HTTP headers at the server level? Isn't it okay
to have validated XHTML 1.0 strict code?
...
|
by: jp29 |
last post by:
My take on problems composing, serving and rendering XHTML
documents/web pages:
1. Typical conscientious web authors are producing XHTML documents (Web
pages) that feature valid Markup and with the content (MIME) type
specified as text/html
(http://keystonewebsites.com/articles/mime_type.php). These pages are
then loaded on to their Server where they are served to Rendering
Agents (browsers) as HTML (SGML application) documents with no...
|
by: Sandy |
last post by:
Hello -
I am using Visual Studio .Net. I need an example of how to construct a
class that can be used throughout a project where I can include its subs and
functions in various pages in the project.
I googled this and either I didn't use the correct words, or there doesn't
seem to be much on it.
Any help will be appreciated!
| |
by: Lee Chapman |
last post by:
Hi,
I am having difficulty getting the ASP.NET framework to generate valid
XHTML. My immediate problem surrounds user input in, for example, textbox
controls.
I consider characters such as less-than and ampersand perfectly valid in
user input. So I've disabled request validation by adding the following to my
web.config file.
|
by: Gianni Rondinini |
last post by:
hi all. please excuse the misusage of some tech terms, but writing in
english is not as easy as in italian :)
i'm designing our new website and, since i want to do something that
will last as long as possible and since i'm not in a hurry at all, i
wanted to use the most up-to-date authoring language.
i use quite a lot html 4.01 in the past, then i recently read
carefully the xhtml 1.0 specifications on the w3.org website --just
few...
|
by: Dan Jacobson |
last post by:
I shall jump on the XHTML bandwagon.
I run my perfectly good html4/strict pages thru
$ tidy -asxhtml -utf8 #to get:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html
xmlns="http://www.w3.org/1999/xhtml"> <head><meta
http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta
http-equiv="Content-Language" content="zh-tw" />
knowing all the time as...
|
by: Rolf Welskes |
last post by:
Hello,
if I have for example:
<table style="width: 100%; height: 100%;" border="1">
<tr>
<td style="width: 100px">k
</td>
<td style="width: 100px">k
</td>
</tr>
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
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...
| |