[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XML style selected by browser language setting?

Subject: Re: XML style selected by browser language setting?
From: Mike Trotman <mike.trotman@xxxxxxxxxxxxx>
Date: Wed, 30 Jun 2004 11:49:58 +0100
browser language
I don't think you can achieve this simply without a web-server (which will communicate between the browser and the file system).

A (laborious) alternative is to have all your stylesheets output the necessary language specific alternatives and javascript code to correctly choose them and render the document in the browser language when it is loaded.

Harald Brinkmann wrote:

This is what I am trying to achieve without much success so far:

On a local harddrive or network (so there is no web server involved) the
user will point his file browser at some xml file. The xml file will
reference an xsl stylesheet like this:

<?xml-stylesheet type="text/xsl" href="Stylesheet.xsl"?>

My aim is for the stylesheet to find out the language setting of the user's
browser. I have tried JavaScript navigator.language. While I managed to show
the language setting in the browser window, what I really want, is to select
language dependent style info, like keywords, data format, etc., based on
the language setting. So, if my xml file contains something like this:

<Distance>100</Distance>

With a browser language setting of German this might automatically be
displayed as:

Entfernung: 100 km

and with English-US as:

Distance: 62 miles

My problem is not having multiple stylesheets achieving this, or using
external files with the language dependent info, the problem is the
automatic selection of the proper styling based on the browser setting.

I do not want to have the user having to select a language by some on-screen
mechanism. This only has to work in Internet Explorer 6.0, but if this also
works for other browsers that would be even better.

Since I am relatively new to the combination of xsl and scripting I would
appreciate an answer with foolproof examples that I can understand.

Cheers

Harald





-- Datalucid Limited 8 Eileen Road South Norwood London SE25 5EJ United Kingdom

/
tel :0208-239-6810
mob: 0794-725-9760
email: mike.trotman@xxxxxxxxxxxxx

UK Co. Reg:   4383635
VAT Reg.:   798 7531 60

/


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.