User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.3) Gecko/20030312
Build Identifier: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.3) Gecko/20030312
Mozilla currently has no support for XML Inclusions (XInclude) as far as I can
tell. SInce the necessary background parts (Including the XPointer stuff which
just recently got fixed) are in there already, it's not as if this looks at
first glance as if this would be too difficult to implement.
Steps to Reproduce:
Created attachment 120282 [details]
document.xml file for Basic Inclusion example in spec
Created attachment 120284 [details]
disclaimer.xml file for Basic Inclusion example in spec
Added the dependencies, even tho they are for features already added just in
case they should somehow become unfixed or implementing this enhancement
requires changes to them.
Created attachment 134605 [details]
file that points directly to the disclaimer
Added <?xml-stylesheet?> so we can see if it is included. And altered value of
the xi:href attribute.
Comment on attachment 134605 [details]
file that points directly to the disclaimer
<?xml version="1.0" encoding="utf-8"?>
<p>120 Mz is adequate for an average home user.</p>
Created attachment 134607 [details]
file that points directly to the disclaimer.xml file
Sorry for all the spam. Description is the same.
IMHO it's time to start implement XInclude.
(In reply to comment #7)
> IMHO it's time to start implement XInclude.
I totally agree.
Created attachment 164717 [details]
textual inclusion example
Created attachment 164718 [details]
plain text to textual inclusion example
Created attachment 164719 [details]
textual inclusion example - how it should look like
Now XInclude is W3C Recommendation. http://www.w3.org/TR/2004/REC-xinclude-20041220/
This could perhaps be implemented using XTF.
Hmm, when should the 'load' event be dispatched,
after processing all xi:include elements? In that case
XTF itself may not be enough - but still useful.
Personally, I'd prefer to see that implemented in pure C++ (as this is, of
coure, faster and not that more difficult).
Look at NS_NewElement(...) in
#400). When implementing a new namespace, you just need to insert a new if(...)
And actually it may (or should) be possible to implement this as an Extension,
a bit like XForms.
Oh yes, you can implement XTF extensions with C++ - but why not directly if
I haven't yet read the specification exactly, but if every xi:include-element
could only include one root node with children, not some consecutive nodes, the
implementation shouldn't be that hard (insert a NS_NewXInclude() function into
the namespace manager, which doesn't return the include-element itself but the
tree to be included).
OK, I don't think that would work... Once because inclusion of multiple nodes
with a single xi:include is possible, and also because a former processed
xi:include-element must be adressable by later ones. So we need some sort of
loop over the tree once it has finished loading. Is it possible to register an
event listener or something like that therefore? (onload doesn't seem to be good
for that, because once onload is fired, the tree should be finished (including
Taking this for now. Not promising anything yet.
If you need help (maybe implementing some special features), ask me.
Created attachment 173672 [details] [diff] [review]
Just an initial patch. Doesn't support XPointer and lacks also loop detection
Created attachment 174149 [details] [diff] [review]
Slowly adding new features. This one supports XPointer with external files.
Also charset conversion etc.
A lot of http://www.w3.org/XML/Test/XInclude/#releases XI examples.
Did you read the last paragraph of
http://www.w3.org/TR/2004/REC-xinclude-20041220/#creating-result, right before
That seems really hard to implement :(. You'd basically have to clone the
document before any includes are processed
While trying to move to a on-the-spot conversion (XML + XSLT) --> HTML for Firefix, I hit this limitation... Till now I was using XInclude for manual processing, but I cannot do it inside the browser.
Are there any alternatives to XInclude?
Currently I might use SSI on the server side to include the necesarry file (it is a kind of glossary) in the document, but that is not a good solution anyway.
No progress since february, so I guess asking about a target to land in mainline is naive...
In the context of XSLT you might be able to replace XInclude with either the <xsl:import> element or the document() XPath function.
However, that doesn't change the fact that this bug is IMHO something we want to fix.
I'm also looking for a way to include a XML file into another XML file.
<xsl:import> can only include a stylesheet into another stylesheet, not it's not what I'm looking for.
Are there any other alternatives?
As Jonas said, with XSLT you can use something like
<apply-templates select="document('abc.xml');" />
But of course this is not XInclude and does not affect that this bug should be fixed...
(In reply to comment #24)
> Did you read the last paragraph of
> http://www.w3.org/TR/2004/REC-xinclude-20041220/#creating-result, right before
> the example.
> That seems really hard to implement :(. You'd basically have to clone the
> document before any includes are processed
IMO the xpointer feature is not that important. A partial XInclude implementation where this feature is omitted would satisfy me, at least.
Otherwise, maybe the xi:include elements could be not replaced but get the included content as their contents. This would result in invalid xml however.
Cloning the source document might be the only option to do this right.
This seems like something that would be / could potentially be, widely used if implemented. Being able to include arbitrary XML documents in one another seems an awfully fundamental ability to have been left out for so long...
Note that often, you may be tempted to identify the target for inclusion by its ID -- see bug # 275196 , 6 years old... Without xml:id implemented, you're left with a subset of the element() scheme or including entire files (with just @href, no @xpointer).
Still, you're right, even @href-based inclusion alone would be a *leap* forward.
Funny post from the now defunct CDF/WICD mailing list:
"I think that are too many different ways to build compound documents, either
by reference or by inclusion.
At the moment we have:
1) XHTML2 embedding attributes
2) XHTML2 / 5 object
3) XHTML5 embed
5) XLink type="embed" / type="resource"
6) CSS content: uri(); property
7) DTD external entities
8) XBL or XSLT (which could transform markup across languages)
9) Direct inclusion (ie plain writing or server-side processing)
Plus we have media specific, like svg image, xhtml 2/5 img, smil media
object, css background-image / border-image;
I was wondering if any work was started to provide a unform way, instead of
relying on single language capabilities (which seems the current orientation
of CDRF and CDIF)
And yet none of these are quite ideal (well I suppose the generalized object tags from XHTML 2 would have been pretty cool, but even that wouldn't have solved the problem on the lower level of XML.)
I'm unfortunately still resorting to SSI probably more than I should.
We don't want this.