[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: Ross Bleakney <rossb@xxxxxxx>
Date: Wed, 8 Dec 1999 09:59:37 -0800
ross bleakney
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.">

A different way this could be handled would be to output the message like
this:

<message msgID="32"><UserString1>Fred</UserString1></message>

I could then write XSL to handle this. Keep in mind that there may be a
hundred or so different messages and that each message may have several user
defined strings. For example, using my first method, I might output:

<message>Fred&MSG32A;Accounting&MSG32B;</message>

With the DTD:

<!ENTITY MSG32A ", who is a member of ">
<!ENTITY MSG32B ", is sick today.">

I could come up with an XML format that would enable me to handle everything
within an XSL file. However, I fear that such an XSL file would be rather
long and messy (with a huge number of xsl:if statements).

Now as far as your specific solutions. I am afraid that Marco's idea
wouldn't work too well for me for the reason he mentioned. For me to parse
only to add a line to specify the DTD would require more work than simply
copying the language specific DTD. If the XML file was small and the DTD
file was big, then Marco's idea would work well. However, in most cases, it
will be the other way around.

I am not sure I fully understand Gene's idea and how it would benefit me.

In any event, I appreciate the time and effort that both of you spent. I
hope this gives you a better understanding of my problem.

Thanks,
Ross

-----Original Message-----

Hi Marco, I think what ross really want is "Macro" :-)
Forgive me, 
you can define <!ENTITY % X Y>,
which is aliasing X to Y to reuse Y's definition.
But also keep X's name to be content related.

The only problem is that you can not aliasing directly
like this <!ELEMENT A  (B, C, %X; )>.
Actually you might have to do it in two seperate steps.
Is that right ross?

Thanks!
Gene

Marco.Mistroni@xxxxxxxxx wrote:

  hi ross,
           you have to do like this:

  - specify the DTD in an external file(say 'foo.dtd')
  - parse the document with a parser that allows you to add a <!DOCTYPE to
an
  XML file (the drawback, however, is that  you must parse the document only
  for adding the DTD)...

  but if you can tell me what you want to do in detail i can help u in a
  better way...
  anyway the idea is to create an external DTD to addto an XML file
  regards
          marco


 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.