RE: Dynamically specifying the DTD

Subject: RE: Dynamically specifying the DTD
From: Ross Bleakney <rossb@xxxxxxx>
Date: Thu, 9 Dec 1999 16:41:19 -0800
Thanks for your idea. I had considered using document() but it probably
would have taken me a long time to figure out the exact syntax to get it to
work. With your snippet of code, things will go quicker. It looks like I
will not use a DTD to handle translation (thanks to the folks that talked me
out of it). Instead, I will use a different XSL file for each language. The
key argument that was made is that sometimes a language translation involves
rearranging the order of user defined strings (and not just the localized
strings). For example, the sentence:

"Leif is the son of Eric."

Might be written in a different language as:

"Eric, son of Leif."

or something like that. There is no way to make the second sentence by
rewriting "is the son of" (nor can I write anything before or after to help
things). I had not considered the rearrangement of user strings like that. I
was planning on discussing this with the in house localization expert, but
this will save me some time. I'm afraid my knowledge of localization issues
is pretty limited. Which reminds me of a joke:

"What do you call someone who knows two languages?" "Bilingual"
"What do you call someone who only knows one language?" "American"

I haven't figured out the exact nature of the XSL. I may try different
things and see about performance. I hope someone answers the questions about
performance posted earlier today.

Thanks,
Ross

[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