[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: localizing XML/XSLT with entities?


Subject: Re: localizing XML/XSLT with entities?
From: "John E. Simpson" <simpson@xxxxxxxxxxx>
Date: Sat, 05 Feb 2000 08:55:29 -0500

At 09:33 PM 02/04/2000 -0500, Ray Cromwell wrote:
Simply put, Mozilla uses XML entities to reference what C++/GUI coders
and Java codes would refer to as resources or ResourceBundles.

Thus, instead of writing something like

they write Then, all of the locale specific content it put into ENTITY declarations in an external DTD located via a chrome:// URI that fetches the DTD from the appropriate directory. What confuses me, is if the XUL document already has a !DOCTYPE declaration referencing the XUL DTD, is it legal to reference a second external DTD? Is there a legal way for DTD's to include another DTD or a bunch of entity declarations? Or, for a document to reference multiple DTD's at once? I know you can use external entities in the main document, but ideally, you would like to separate all the entity declarations into an external file making it easy to edit locale specific content in a single location without mucking with the main document DTD. I suppose you could use xsl:include/import and load up a whole bunch of statements to get the same effect, but the syntax for referencing variables isn't quite as nice as entities, and sometimes the source XML document needs localization. -Ray

I don't know what the Mozilla code looks like; your mailer seems to have stripped out anything that looks like markup. But it sounds like they're using INCLUDE/EXCLUDE "conditional" sections in the DTD, together with external parameter entities for incorporating other DTDs which, yes, is a legal and (not always, but sometimes!) useful approach.


An example in the XML Rec. [3.4]:

  <!ENTITY % draft 'INCLUDE' >
  <!ENTITY % final 'IGNORE' >

  <![%draft;[
  <!ELEMENT book (comments*, title, body, supplements?)>
  ]]>
  <![%final;[
  <!ELEMENT book (title, body, supplements?)>
  ]]>

The PEs in the first two lines tell the DTD that in its current pass, the processor should include the declaration of the book element performed by the %draft; PE, and *not* include that performed by the %final; PE. If you want the processing to treat the book element as though it declares a "final version's" content model, just switch the INCLUDE/IGNORE values of the two PEs.

(Further discussion along these lines probably should move off-list, or to XML-L or XML-DEV.)
====================================================================
John E. Simpson | My girlfriend asked me, "Did you sleep
simpson@xxxxxxxxxxx | good?" I said, "No, I made a few
http://www.flixml.org | mistakes." (Stephen Wright)



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




Current Thread
Keywords
xml