Firefox and external XML entity references

I’m currently doing some work with XML and representing it as HTML in browsers using XSLT by including a reference to a style sheet. To reduce dublicating too much information across the different XML files I produce and use external entity references.

For those that doesn’t know what an external entity reference is let me give a short explanation. Bascially XML allows you to define an entity using the DOCTYPE declaration that may be referenced from within the XML document. A reference to an XML fragment as an entity may be internal (in the document itself) or external (in another file). The below code snippet shows how to reference an external file as an entity:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE file_contents [
   <!ENTITY external_info SYSTEM "external_info.xml">
   <!ENTITY internal_info "Some internal information">
]>
<file_contents>
   &external_info;
   &internal_info;
</file_contents>

In the above example the &external_info; will be replaced with the contents of the external_info.xml file and &internal_info; will be replaced with “Some internal information” when the file is parsed.

I found one limitation though when using external entity references in that Firefox doesn’t include XML from these external references in the source document for the XSLT transformation (or when previewing the document). This isn’t an issue in Internet Explorer at all so for this particular project it’s nice that the users are on Internet Explorer.

After researching the issue on Google I found an article on developerWorks (XML in Firefox 1.5, Part 2: Basic XML processing) that confirms my findings:

"As far as reading external files, Firefox does not read any external entities at all, whether parameter entities (such as DTDs and DTD fragments) or general entities (external, well-formed XML fragments). <snip /> Support of such external entities does have possible security implications, and possible performance implications, but both have workarounds, and I hope Firefox addresses these limitations soon."

I’m using Firefox 1.5.0.3 on Windows XP Prof. SP2.