|
Subject: Re: Dynamically specifying the DTD From: oooo <oooo@xxxxxxxxxxxxx> Date: Mon, 10 Dec 2001 00:16:37 +0100 |
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 |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: Dynamically specifying the DTD, Ross Bleakney | Thread | Serialize DOM, skodali |
| Re: sorting in groups, Mattias Konradsson | Date | |
| Month |