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

element in most preferred language expression?

Subject: element in most preferred language expression?
From: Jack Bates <ms419@xxxxxxxxxxxxxx>
Date: Mon, 12 May 2008 17:37:07 -0700
 element in most preferred language expression?
I am working on an API for an open source records management
application: http://code.google.com/p/qubit-toolkit/

The data in the application consists of hierarchically organized
objects, and object properties. Because of this data's resemblance to
XML (hierarchically organized elements and element attributes), I am
trying to design an API which resembles XPath.

I think the advantages of an API which resembles XPath is that it is
comfortable to developers who are already familiar with XPath, and that
it benefits from XPath's proven good design - hopefully taking advantage
of the experience of the people who designed XPath.

For the most part, everything we could want from our API can be
expressed in XPath. One challenge I am facing is multilingual data.

Many of our object's properties may be translated into foreign
languages. Happily, I think there is an analogue in XML: the xml:lang

The HTTP Accept-Language request header contains a list of the user's
language preferences and associated weights.

Our API can express the value of a property in a given language. I think
the corresponding XPath expression would be something
like: ./title[@xml:lang = "fr"]

- the challenge is expressing the value of a property in the most
preferred language. I can do this in code, by iterating over the user's
language preferences, getting the property value in each language until
I get a non-empty node set. However I would like to capture this
behaviour behind our API. Ideally a developer could express the value of
a property in the user's most preferred language in a single expression.
Furthermore, this expression could be combined with other expressions,
to get for example, the titles of all an object's children, in the
user's most preferred language.

What is the closest XPath expression which could get the value of an
element in a most preferred language? What advice do you have for how to
express this in our API?

Thanks and best wishes, Jack

Current Thread


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.
First Name
Last Name
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.