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

Re: Dynamically specifying the DTD

Subject: Re: Dynamically specifying the DTD
From: oooo <oooo@xxxxxxxxxxxxx>
Date: Mon, 10 Dec 2001 00:16:37 +0100
oooo
Ross Bleakney wrote:

> Both of you have some good ideas, but before I consider them, let me explain
> my situation in more detail. I have to output some information that contains
> both user defined (non-localized) strings combined with localized strings.
> For example, I might want to output the following message:
> 
> "Fred is sick today"
> 
> The "Fred" part is user defined (and not localized) while the " is sick
> today." needs to be localized. I would like to output information to an XML
> file and then later (at presentation time) localize it. I can think of a
> couple ways to do this. My original idea was to output the information like
> this:
> 
> <message>Fred&MSG32;</message>
> 
> In the DTD would be the line:
> 
> <!ENTITY MSG32 " is sick today.">
> 
[snip]
hi ross.

I think you could solve this, with the document() function in your xsl.

with :

<message>Fred<msg nr="32" /></message>

in your XML and a some others with localized entries like

local_en.xml :
<msg nr="32"> is sick today</msg>

and local_de.xml :
<msg nr="32"> ist heute krank</msg>

and then in your xsl do something like this (sorry this is pseudo xsl, as I
just have 5 days of xsl experience)

<xsl:template match="msg">
    <x:param name="nr" select="@nr" />
    <x:value-of
        select='document(#filename#)//*[local-name()="msg" and @nr=$nr]'
    />
</x:template>

where #filename# will be local_en.xml for english-output or local_de.xml for
german ... and so on.

Hope this is clear ??

Imre


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.