Re: [xml2rfc] include processing directive

Erik Wilde <dret@berkeley.edu> Tue, 12 November 2013 06:40 UTC

Return-Path: <dret@berkeley.edu>
X-Original-To: xml2rfc@ietfa.amsl.com
Delivered-To: xml2rfc@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id CACE821E80AE for <xml2rfc@ietfa.amsl.com>; Mon, 11 Nov 2013 22:40:53 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.599
X-Spam-Level:
X-Spam-Status: No, score=-6.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, RCVD_IN_DNSWL_MED=-4]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EWxYLLAhm4YD for <xml2rfc@ietfa.amsl.com>; Mon, 11 Nov 2013 22:40:48 -0800 (PST)
Received: from cm03fe.IST.Berkeley.EDU (cm03fe.IST.Berkeley.EDU [169.229.218.144]) by ietfa.amsl.com (Postfix) with ESMTP id 7E72521E808D for <xml2rfc@ietf.org>; Mon, 11 Nov 2013 22:40:47 -0800 (PST)
Received: from c-24-6-239-29.hsd1.ca.comcast.net ([24.6.239.29] helo=dretair.local) by cm03fe.ist.berkeley.edu with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (auth plain:dret@berkeley.edu) (envelope-from <dret@berkeley.edu>) id 1Vg7eX-00047e-BX; Mon, 11 Nov 2013 22:40:47 -0800
Message-ID: <5281CD6D.7090400@berkeley.edu>
Date: Mon, 11 Nov 2013 22:40:45 -0800
From: Erik Wilde <dret@berkeley.edu>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.1.0
MIME-Version: 1.0
To: Nico Williams <nico@cryptonector.com>, XML2RFC Interest Group <xml2rfc@ietf.org>
References: <0a3701cede91$2bff9f40$83feddc0$@augustcellars.com> <5280A009.8000702@gmx.de> <CAK3OfOjs=2HiYe6rvocBPPtWO3z3AF4SVMiOutCKxfnzUFVyPA@mail.gmail.com>
In-Reply-To: <CAK3OfOjs=2HiYe6rvocBPPtWO3z3AF4SVMiOutCKxfnzUFVyPA@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"; format="flowed"
Content-Transfer-Encoding: 7bit
Cc: Julian Reschke <julian.reschke@gmx.de>
Subject: Re: [xml2rfc] include processing directive
X-BeenThere: xml2rfc@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: <xml2rfc.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/xml2rfc>, <mailto:xml2rfc-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/xml2rfc>
List-Post: <mailto:xml2rfc@ietf.org>
List-Help: <mailto:xml2rfc-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/xml2rfc>, <mailto:xml2rfc-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 12 Nov 2013 06:40:53 -0000

hello nico.

On 2013-11-11, 22:26 , Nico Williams wrote:
> Agreed.  One use case I've seen a few times is where you have a large
> ASN.1/XDR/whatever module that needs to go in an appendix but select
> pieces of which need to be interspersed with the prose for explanatory
> purposes.  Hand-coding this is extremely error prone.  Here the idea
> would be to markup sub-sections of the module but otherwise have it in
> one piece, then reference specific sub-sections of the module as
> desired.  Another possibility is to spread the module throughout the
> source doc and have functionality to pull all the bits, concatenate
> them, then make the result the appendix -- IMO this second approach is
> terrible, but the first approach requires a fairly radical new
> approach to "artwork".

not really. unless you plan on making <artwork> itself inclusion-enabled 
(which i think would not be such a great way to go), you simply use 
XInclude and you're done. this is a working snippet from 
https://github.com/dret/I-D/blob/master/xml-patch/draft-wilde-xml-patch-08.xml, 
which requires XInclude processing (&files; is defined as 
"draft-wilde-xml-patch-08-files" in the XML):

<artwork type="xml"><xi:include parse="text" 
href="&files;/patch-document.xml"/></artwork>

the current downside of XIPr (the XInclude processor i am using, 
https://github.com/dret/XIPr) is that you can only include complete text 
files, and not fragments. XInclude 1.1 fixes that, but i haven't 
implemented it yet. i have no idea how widely 1.1 is supported, but i 
would guess that most current XInclude implementations are 1.0 only. 1.1 
support would allow something like this:

<artwork type="xml"><xi:include parse="text" 
href="&files;/patch-document.xml#line=10,12"/></artwork>

one problem is that if you support 1.1 (i.e., fragments for textual 
inclusion), once you insert one line at the start of your included file, 
you have to adjust all fragment identifiers or they'll "get out of sync" 
(integrity checks http://tools.ietf.org/html/rfc5147#section-3.1 can be 
used to detect this situation, but they won't fix it). there's no easy 
way around this. but apart from that, it's certainly much better than 
what i was doing before, i.e. copy/pasting files into the XML source.

cheers,

dret.

-- 
erik wilde | mailto:dret@berkeley.edu  -  tel:+1-510-2061079 |
            | UC Berkeley  -  School of Information (ISchool) |
            | http://dret.net/netdret http://twitter.com/dret |