xsl-list
[Top] [All Lists]

Re: [xsl] XSLT and XInclude?

2009-03-23 09:12:26
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.


I haven't worked with 2.0 very much, so I wasn't aware of this feature, I
was looking for a parameter on the doc() function itself. I think this
might do the trick. Mainly I had been trying to use a mode on the template
but I don't think that was working



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.

Thanks, I've got to figure out how these documents ended up the way they
did. There was a combination of editing with an XML editor and possibly
some other programatic changes that might have stripped the namespace from
the included file.

I was just surprised that the editor we use treated this as a valid
document and it wasn't until I processed the files with saxon that I got
an error. I was also "thinking" that this was a hybrid entity which it's
not, so that threw off my internal processing model and how things might
work.



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.

This was a specific issue that surprised me from a couple of different
standpoints. The folks that created this process used the XInclude as a
replacement for entities and they have different properties. I got sucked
in thinking XInclude was an entity substitute as well (that's how our
editor seems to treat them as well). Thinking about it from the included
document side, they should be valid documents.

thanks

..dan


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(_at_)CraneSoftwrights(_dot_)com
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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>