localizing XML/XSLT with entities?
Has anyone taken a look at Mozilla's XUL/CSS/DTD architecture? I took a look at it recently to see how they implemented reuse/cascade in XUL with CSS/XSL, and what I found was interesting. On my own site, what I had done was use separate XSLT stylesheets for different languages and look-and-feels, but this quickly turns out to be unmaintainable. A lot of "view" oriented code is duplicated, and if you fix a bug in one sheet, or make an enhancement, you have to update them all. And that's after liberal use of xsl:include and xsl:import. Mozilla takes a clever approach, but I'm unsure how "standard" it is, and whether or not it could break future XML processors. 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 <html:widget name="foo" label="Enter your text here."/> they write <html:widget name="foo" label="&foo.label;"/> 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 <xsl:variable> 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 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format