OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook] xi:include problem


Hi Alex

On 11/12/2013 06:22, Alex Kleider wrote:

> On 2013-12-10 06:47, Shaun McCance wrote:
>> On Tue, 2013-12-10 at 00:38 -0800, Alex Kleider wrote:
>>> On 2013-12-09 22:55, davep wrote:
>>>
>>>> Jing is a validating parser, it knows nothing of xinclude.
>>>> Use a tool to expand the xincludes prior to processing (validation and
>>>> transformation).
>>>>
>>>> HTH
>>>
>>> Thanks for the tip.  I did some searching and found xmlstarlet but it
>>> seems not to want to deal with RELAX NG:
>>> """
>>> alex@x301:~/Docbook/Opus$ xmlstarlet tr --xinclude
>>> /usr/share/xml/docbook/schema/rng/5.0/docbook.rng main.xml
>>> compilation error: file
>>> /usr/share/xml/docbook/schema/rng/5.0/docbook.rng line 2 element
>>> grammar
>>> xsltParseStylesheetProcess : document is not a stylesheet
>>> """
>>> A little more poking around and I came up with
>>> $ xmlstarlet tr --xinclude
>>> /usr/share/xml/docbook/stylesheet/docbook5/db4-upgrade.xsl
>>> dreamplug.xml
>>>   > dream.xml
>>> which when followed by
>>> $ jing /usr/share/xml/docbook/schema/rng/5.0/docbook.rng dream.xml
>>> all seems to work fine.
>>>
>>> I don't quite understand why a program that expands xincludes would
>>> want/need a style sheet.
>>> I would have thought that one wouldn't be necessary until the next
>>> step
>>> after validation:
>>> $ xmlto --skip-validation html dream.xml
>>> although xmlt never seems to complain at not having one.  I've assumed
>>> it was using a default.
>>
>> xmlstarlet is not just a program for expanding XIncludes. You passed it
>> the 'tr' command, which is for applying XSLT. If you want to validate
>> against a schema and do XInclude processing, use xmllint, which will
>> happily handle both XIncude and RNG for you:
>>
>> xmllint --xinclude --noout
>> --relaxng /usr/share/xml/docbook/schema/rng/5.0/docbook.rng dream.xml
>>
>> --
>> Shaun
>
> Thanks, Shaun, for taking an interest.
> On my (Ubuntu 12.4) system,
> apt-cache search xmllint =>
> libxml2-utils - XML utilities
> bluefish - advanced Gtk+ HTML editor
>
> Googling xmllint tells me that "It is included in libxml2."
> A little more time with the man page should get me up to speed.
>
> I very much appreciate the tip.
> cheers,
> alex

Sorry, I think Shaun's solution is not quite what you want.

xmllint does not (unless I've missed a recent update) validate correctly 
against .rng.

Use xmllint to resolve the xincludes without validation, e.g.:

$ xmllint --output Temp.xml --xinclude Input.xml

Then use jing to validate the temp.xml file, e.g.:

$ jing /path/to/docbook.rng Temp.xml

I'm pretty sure xmllint is installed in Ubuntu 12.04 by default and Jing 
is available in the repositories.

You can put these steps together in a simple script file or maybe in an 
XML pipeline [http://en.wikipedia.org/wiki/XProc].

> is xmllint part of libxml2-utils?
>
> Also, in your call to xmllint, what does the noout parameter signify and
> where do you specify the source file?
> (I'm sure I could figure all of this out if I could find

See http://xmlsoft.org/xmllint.html for help on the parameters.
-- 
Simon Dew

Technical Author | Stanley Security Solutions
1 Park Gate Close, Bredbury, Stockport SK6 2SZ, U.K.

Simon.Dew@SBDInc.com | +44 (0) 161 406 3400
www.stanleysecuritysolutions.co.uk

Registered Office: Stanley House, Bramble Road, Swindon
Registered in England and Wales No. 181585 VAT No. 232 2446 95


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]