Re: [xslt] double parse xincludes?
- From: Daniel Veillard <veillard redhat com>
- To: Bob Stayton <bobs caldera com>
- Cc: xslt gnome org
- Subject: Re: [xslt] double parse xincludes?
- Date: Wed, 16 Jan 2002 16:14:02 -0500
On Wed, Jan 16, 2002 at 12:14:52PM -0800, Bob Stayton wrote:
> On Wed, Jan 16, 2002 at 01:45:13PM -0500, Daniel Veillard wrote:
> > Unless you have troubles with the defaulting of attributes
> > (but I don't think this should happen) the XSLT processing
> > should work fine with XInclude even if there isn't a validation
> > phase.
> >
> > If you really want to validate something with libxml2/libxslt
> > you should use xmllint. More precisely
> > xmllint --valid --noout document.xml
> >
> > will run the parser in validating mode.
>
> In general, processing of the included content with
> xsltproc works very well. The one feature that does not
> work is ID/IDREF between xincluded content. Now, I
> personally don't think it is a good idea to create
> ID/IDREFs between separate XML documents, because then the
> individual documents don't validate. But some people
> set up their modular content that way. The
> ID/IDREFs do work when system entities are used instead
> of Xincludes to assemble a larger logical document.
You know, XInclude is not a finalized specification,
(http://www.w3.org/TR/xinclude/ check the status Section at least)
and the ID/IDREF "fixup" is actually part of the changes
we had to look at as part of the early drafts comments.
My implementation doesn't implement them, I will have to update
it once we release the new version. It's currently in Last Call
at W3C.
> BTW, I'm testing all this with the DocBook XSL 1.48
> stylesheets, using <link linkend="foo">bar</link>, where
> 'foo' is an id value on an element in another included
> file. The error message reported from the stylesheet is
> "Error: no ID for constraint linkend: foo".
>
> I wonder if the stylesheet used a <xsl:key> defined
> for the id attributes instead of the id() function
> if it would find its match in the included content when
> run in xsltproc.
No, it's just that the ID from the documents are not merged.
It's slightly more complex than a simple "merge" because there is
a possibility of ID clashes, or XInclude could actually import
only a fragment of the original resource (using the XPointer
fragment identifier on the URI).
> > If you want to to validate the result of an XInclude processing
> > you need to ask it to validate on the parsed form
> >
> > xmllint --postvalid --xinclude --noout document.xml
> >
> > I checked the postvalidation should occurs after the XInclude
> > processing and provide you with the expected errors if the
> > result ain't kosher per the DOCTYPE of document.xml.
>
> That's nice, the ID/IDREFs between xincludes are validated
> when the master file is processed in this manner.
Hum, right ... it rescans the full tree and hence rebuilds the
ID and IDREFs tables from scratch.
> Now if I could just get a --postvalid option on xsltproc. 8^)
Well, it's not really validation, but yes I understand your point,
in practice though, the upcoming ID/IDREF fixup of XInclude would have
to be implemented. Possibly just by fixing the tree copying routines.
Work in Progress, ...
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
veillard@redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]