The default bug view has changed. See this FAQ.

XML Inclusions (XInclude)

VERIFIED WONTFIX

Status

()

Core
XML
--
enhancement
VERIFIED WONTFIX
14 years ago
3 years ago

People

(Reporter: Ernest Cline, Unassigned)

Tracking

({helpwanted})

Trunk
Future
helpwanted
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(6 attachments, 3 obsolete attachments)

(Reporter)

Description

14 years ago
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.

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
(Reporter)

Comment 1

14 years ago
Created attachment 120282 [details]
document.xml file for Basic Inclusion example in spec
(Reporter)

Comment 2

14 years ago
Created attachment 120284 [details]
disclaimer.xml file for Basic Inclusion example in spec
(Reporter)

Updated

14 years ago
Attachment #120284 - Attachment description: File for Basic Inclusion example in spec → disclaimer.xml file for Basic Inclusion example in spec
(Reporter)

Updated

14 years ago
Attachment #120282 - Attachment description: File for Basic Inclusion example in spec → document.xml file for Basic Inclusion example in spec
(Reporter)

Comment 3

14 years ago
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.
Depends on: 32842, 182323
Status: UNCONFIRMED → NEW
Ever confirmed: true
Target Milestone: --- → Future

Comment 4

14 years ago
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 5

14 years ago
Comment on attachment 134605 [details]
file that points directly to the disclaimer

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet?>
<document xmlns:xi="http://www.w3.org/2001/XInclude">
  <p>120 Mz is adequate for an average home user.</p>
  <xi:include
href="http://bugzilla.mozilla.org/attachment.cgi?id=120284&amp;action=view"/>
</document>

Updated

14 years ago
Attachment #134605 - Attachment is obsolete: true

Comment 6

14 years ago
Created attachment 134607 [details]
file that points directly to the disclaimer.xml file

Sorry for all the spam. Description is the same.

Updated

13 years ago
Attachment #120282 - Attachment is obsolete: true

Updated

13 years ago
Keywords: helpwanted
OS: Windows 98 → All
Hardware: PC → All

Updated

13 years ago
Whiteboard: Spec is in CR

Updated

13 years ago
Whiteboard: Spec is in CR → Spec is in PR

Comment 7

13 years ago
IMHO it's time to start implement XInclude.

Comment 8

13 years ago
(In reply to comment #7)
> IMHO it's time to start implement XInclude.

I totally agree.

Comment 9

13 years ago
Created attachment 164717 [details]
textual inclusion example

Comment 10

13 years ago
Created attachment 164718 [details]
plain text to textual inclusion example

Comment 11

13 years ago
Created attachment 164719 [details]
textual inclusion example - how it should look like

Comment 12

12 years ago
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.

Updated

12 years ago
Whiteboard: Spec is in PR

Comment 14

12 years ago
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 
mozilla/content/base/src/nsNameSpaceManager.cpp#400 
(http://lxr.mozilla.org/seamonkey/source/content/base/src/nsNameSpaceManager.cpp
#400). When implementing a new namespace, you just need to insert a new if(...) 
there.
You can do XTF extensions using C++ or JavaScript.
And actually it may (or should) be possible to implement this as an Extension,
a bit like XForms.

Comment 16

12 years ago
Oh yes, you can implement XTF extensions with C++ - but why not directly if
possible?

Comment 17

12 years ago
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).

Comment 18

12 years ago
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
XInclude processing)...)
Taking this for now. Not promising anything yet.
Assignee: hjtoi-bugzilla → smaug

Comment 20

12 years ago
If you need help (maybe implementing some special features), ask me.
Created attachment 173672 [details] [diff] [review]
v 0.0.1

Just an initial patch. Doesn't support XPointer and lacks also loop detection
etc.
Created attachment 174149 [details] [diff] [review]
v 0.0.2

Slowly adding new features. This one supports XPointer with external files.
Also charset conversion etc.
Attachment #173672 - Attachment is obsolete: true

Comment 23

12 years ago
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
the example.

That seems really hard to implement :(. You'd basically have to clone the
document before any includes are processed

Comment 25

12 years ago
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.

Comment 27

10 years ago
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? 

Comment 28

10 years ago
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...

Comment 29

8 years ago
(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.
QA Contact: ashshbhatt → xml

Comment 30

7 years ago
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...

Comment 31

7 years ago
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.

Comment 32

7 years ago
Funny post from the now defunct CDF/WICD mailing list:
http://lists.w3.org/Archives/Public/public-cdf/2008Dec/0000.html

"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
4) XInclude
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)

Giovanni"

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.
Assignee: bugs → nobody
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → WONTFIX

Updated

3 years ago
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.