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

Re: [xsl] XSLT and XInclude?


Subject: Re: [xsl] XSLT and XInclude?
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 23 Mar 2009 11:15:26 +0100

At 2009-03-21 13:35 -0400, Dan Vint wrote:
I've come across some documents that are using XInclude to fragment a larger tech manual. I've got the basic stylesheet working that reads the document name from the href and then opens it with the doc() function.

In this particular case, I'm able to process the content properly as the included document has a regular structure that I can process directly. I got to thinking though that I might need to process these included files within the context of their use/placement in the referencing document.

From a processing perspective I would pass including context information in tunnel parameters to the template rules acting on the included content. This XSLT 2.0 feature is amazing and I've found it very useful.


But I'm not sure that is the focus of your post.

Anyway, there was some change tracking markup added via some add/delete elements in a different namespace. Within the parent the namespace was defined, but the included file didn't have the declaration. When this file was passed to the doc function it errored out because the namespace wasn't defined in the included file.

Looking at http://www.w3.org/TR/2006/REC-xinclude-20061115/ I think you are stuck. Section 4.2 indicates that the resource is treated as application/xml and so it would have to be well-formed.


I fixed this problem by correcting the included file, but if I could have passed the context (in this case the namespace information) I wouldn't have had a problem.

That is a parsing context issue as opposed to a processing context issue. While I believe processing context discussions are appropriate for stylesheets and other applications working on XML, I do not think we have any latitude to work with the parsing context. I cannot see any way of proposing changes to the parsing context that would not destabilize the entire concept of well-formedness. Given one can use a conforming XML processor to implement XInclude, proposing any changes to XInclude to incorporate an external augmentation of the parsing context would prevent an existing conforming XML processor to work.


So unless I've misunderstood you, I think you are stuck having to require the application adding the change tracking markup to correctly create a well-formed XML document.

I hope this helps.

. . . . . . . . . . . . . Ken

--
XSLT/XSL-FO/XQuery training in Los Angeles (New dates!) 2009-06-08
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


Current Thread
Keywords