RFC 7749 through XSLT | J. Reschke |
greenbytes | |
July 2019 |
This document describes a set of XSLT transformations that can be used to transform "XML2RFC" XML ([RFC7749], updating [RFC2629]) to various output formats, such as HTML and PDF. The main topics are ¶
The full distribution is available at <https://greenbytes.de/tech/webdav/rfc2629xslt.zip>. A mirror of the non-public source repository can be found at <https://github.com/reschke/xml2rfc>; this is also a good place for reporting issues.¶
rfc2629.xslt supports both all grammar elements defined in [RFC7749], plus a subset of the new elements defined in [RFC7991bis].¶
rfc2629.xslt supports two kind of extension elements, using different XML namespaces.¶
The first set contains (hopefully) generally useful extensions, see Section 11.¶
The second set is used for change and issue tracking and currently is not documented here. Please email the author in case you're interested in using these extensions.¶
All PIs can be set as XSLT parameter as well, overriding any value that is found in the source file to be transformed.¶
Using processing instructions:
<?rfc toc="yes"?> <?rfc-ext support-rfc2731="no"?>
Using XSLT parameters (Saxon):
java -cp saxon.jar com.icl.saxon.StyleSheet source.xml rfc2629.xslt \ xml2rfc-toc=yes xml2rfc-ext-support-rfc2731=no > result.html
Using XSLT parameters (xsltproc):
xsltproc --param xml2rfc-toc '"yes"' \ --param xml2rfc-ext-support-rfc2731 '"no"' \ rfc2629.xslt source.xml > result.html
(note the required quoting of string parameters)
PI target | PI pseudo-attribute | XSLT parameter name | default | comment |
---|---|---|---|---|
rfc | authorship | xml2rfc-authorship | "yes" | when set to "no", the "Authors" section is suppressed |
rfc | background | xml2rfc-background | (not set) | |
rfc | compact | xml2rfc-compact | "no" | only applies to HTML output method when printing |
rfc | comments | xml2rfc-comments | (not set) | |
rfc | docmapping | "yes" | This is the default for rfc2629.xslt anyway, and it can not be changed | |
rfc | editing | xml2rfc-editing | "no" | |
rfc | footer | xml2rfc-footer | (not set) | |
rfc | header | xml2rfc-header | (not set) | |
rfc | include | only partly supported, use external entities instead (see Appendix C.1) or other tools (Section 13.8) instead | ||
rfc | inline | xml2rfc-inline | (not set) | |
rfc | iprnotified | xml2rfc-iprnotified | "no" | |
rfc | linkmailto | xml2rfc-linkmailto | "yes" | |
rfc | multiple-initials | xml2rfc-multiple-initials | "no" | determines whether the processor will attempt to truncate multiple initials to a single one; can be set globally (affecting the front page) but also as child element of <reference> |
rfc | private | xml2rfc-private | (not set) | |
rfc | refparent | xml2rfc-private | "References" | Title for References sections when automatically inserted |
rfc | rfcedstyle | xml2rfc-rfcedstyle | (not set) | (limited support) |
rfc | sortrefs | xml2rfc-sortrefs | "no" | |
rfc | symrefs | xml2rfc-symrefs | "yes" | The default has changed from "no" to "yes" as of June 6, 2007 and xml2rfc 1.33pre4. |
rfc | toc | xml2rfc-toc | "no" ("yes" for documents specifying "3" as vocabulary version) | |
rfc | tocdepth | xml2rfc-tocdepth | 99 | |
rfc | topblock | xml2rfc-topblock | "yes" |
PI target | PI pseudo-attribute | comment |
---|---|---|
rfc | needLines | |
rfc | slides | |
rfc | strict | |
rfc | subcompact | |
rfc | tocindent | (defaults to "yes") |
rfc | tocompact |
PI target | PI pseudo-attribute | XSLT parameter name | default | description |
---|---|---|---|---|
rfc-ext | allow-markup-in-artwork | xml2rfc-ext-allow-markup-in-artwork | "no" | Enables support for specific elements inside abstract elements (using this extension makes the document incompatible to the RFC7749 grammar; see description of conversion XSLT in Section 13.4). |
rfc-ext | authors-section | xml2rfc-ext-authors-section | "end" | When "before-appendices", place the authors section between references and appendices (this ordering was used a long time ago). |
rfc-ext | doi-uri | xml2rfc-ext-doi-uri | "http://dx.doi.org/{doi}" | URI template for DOIs. |
rfc-ext | duplex | xml2rfc-ext-duplex | "no" | When set to "yes", format the PDF output for doublesided printing. |
rfc-ext | errata | xml2rfc-ext-errata | Can be used to specify an errata file; output will link to individual errata when possible. See Section 6.6 | |
rfc-ext | html-pretty-print | xml2rfc-ext-html-pretty-print | Used to specify a JS-based code pretty-printer; the value is the CSS class name to insert, followed by a blank space, followed by the URI of the JS library. For instance: "prettyprint https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js" | |
rfc-ext | include-index | xml2rfc-ext-include-index | "yes" | When set to "no", no index will be generated. |
rfc-ext | include-references-in-index | xml2rfc-ext-include-references-in-index | "no" | When set to "yes", index entries are generated for all references. |
rfc-ext | insert-metadata | xml2rfc-ext-insert-metadata | "yes" | When set to "yes", include JS code that fetches current RFC metadata and inserts it into the front page (standards track, obsoletion, updates, errata). |
rfc-ext | internet-draft-uri | xml2rfc-ext-internet-draft-uri | "https://tools.ietf.org/html/{internet-draft}" | URI template for Internet-Draft links. |
rfc-ext | isbn-uri | xml2rfc-ext-isbn-uri | "https://www.worldcat.org/search?q=isbn:{isbn}" | URI template for ISBN lookup. |
rfc-ext | log-level | xml2rfc-ext-log-level | "WARNING" | default logging level, one of "OFF", "FATAL", "ERROR", "WARNING", "INFO", "DEBUG", "TRACE" |
rfc-ext | justification | xml2rfc-ext-justification | "never" | "never": never emit justified text, "always": always emit justified text, "print": only emit justified text for print media. |
rfc-ext | maxwidth | xml2rfc-ext-maxwidth | 1000 | For HTML output: maximal text width in CSS pixels. |
rfc-ext | parse-xml-in-artwork | xml2rfc-parse-xml-in-artwork | "no" | May be used to enable parsing of XML content in figures (MSXML only). |
rfc-ext | rfc-errata-uri | xml2rfc-ext-rfc-errata-uri | "https://www.rfc-editor.org/errata_search.php?rfc={rfc}" | URI template for all RFC Errata for a given RFC ("rfc" is the RFC number). |
rfc-ext | rfc-erratum-uri | xml2rfc-ext-rfc-erratum-uri | "https://www.rfc-editor.org/errata/eid{eid}" | URI template for a specific RFC erratum ("eid" is the "errata id"). |
rfc-ext | rfc-uri | xml2rfc-ext-rfc-uri | "https://tools.ietf.org/html/rfc{rfc}" | URI template for RFC links. |
rfc-ext | sec-no-trailing-dots | xml2rfc-ext-sec-no-trailing-dots | When set to "no", do not add trailing dots to section numbers (this was the preference in the distant past). | |
rfc-ext | support-rfc2731 | xml2rfc-ext-support-rfc2731 | "yes" | Decides whether the HTML transformation should generate META tags according Section 6.4. |
rfc-ext | xml2rfc-backend | xml2rfc-ext-xml2rfc-backend | based on document date | Used in clean-for-DTD.xslt (see Section 13.4). |
rfc-ext | xref-with-text-generate | xml2rfc-ext-xref-with-text-generate | 'text' | Determines whether <xref> with text content generates additional text as in traditional text output ("text"), or just generates a link around the text ("nothing"). Note that the default might change in the future in order to achieve compatibility with other formatters. |
rfc-ext | ucd-file | xml2rfc-ext-ucd-file | Specifies an external resource containing Unicode character database information, as described in Section 11.24. |
The transformation automatically generates anchors that are supposed to be stable and predictable and that can be used to identify specific parts of the document. Anchors are generated both in HTML and XSL-FO content (but the latter will only be used for PDF output when the XSL-FO engine supports producing PDF anchors).¶
The following anchors get auto-generated:
Anchor name | Description |
---|---|
rfc.abstract | Abstract |
rfc.authors | Authors section |
rfc.copyright | Copyright section |
rfc.copyrightnotice | Copyright notice |
rfc.figure.n | Figures (titled) |
rfc.figure.u.n | Figures (untitled) |
rfc.index | Index |
rfc.ipr | Intellectual Property |
rfc.iref.n | Internal references |
rfc.note.n | Notes (from front section) |
rfc.references | References |
rfc.references.n | Additional references |
rfc.section.n | Section n |
rfc.section.n.p.m | Section n, paragraph m |
rfc.status | Status of memo |
rfc.table.n | Tables (titled) |
rfc.table.u.n | Tables (untitled) |
rfc.toc | Table of contents |
rfc.xref.name.n | References to reference n to name |
The transformation requires a non-standard extension function (see exsl:node-set) which is however widely available. XSLT processors that do not support this extension (or a functional equivalent, such as msxsl:node-set) currently are not supported.¶
Input documents do not always specify the date completely. In this case, the transformation attempts to let the XSLT engine to compute the system date, using either scripting in Microsoft's XSLT engine, or the exsl:date-time extension function.¶
The following XSLT engines are believed to work well: ¶
The following browsers seem to work fine: ¶
Internet Explorer 5.5 (Windows version, if MSXML3 is installed)
Internet Explorer 6 and newer
Firefox 3.0 and newer
Safari 3 (starting with version 3.0.4)
Google Chrome
Opera (starting with version 10)
Note that browsers in general do not load external DTDs nor external entities (see, for instance, Mozilla Bug 22942) thus entities like need to be declared in the internal subset (Appendix C.1).¶
The following browsers are known not to work properly: ¶
Firefox 1.*/2.*: (missing extension function - see change request at Mozilla BugZilla 193678)
Opera 9.21: execution fails, potentially to a somewhat complex XPath expression (reported to Opera as bug 245725).
Opera 9.5 and 9.6: transformation appears to work, but CSS isn't getting applied (reported to Opera as bug 337388 on 2008-06-12).
Safari 2.* supports client-side XSLT as of MacOS X 10.4, but misses required extension functions. A problem with stylesheets producing non-ASCII output (such as NBSP characters) has been fixed as of OSX 10.4.4. Both problems have been reported through Apple's bug tracking system, see <http://drakken.dbc.mtview.ca.us/pipermail/xml2rfc/2005-May/002073.html> and <http://bugs.webkit.org/show_bug.cgi?id=4079>.
Transformation to HTML can be done inside the browser if it supports XSLT. To enable this, add the following processing instruction to the start of the source file:¶
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
(and ensure that rfc2629.xslt is present).¶
The transformation result is supposed to conform to HTML5 [HTML5]. This can be checked using the W3C's online validator at <http://validator.w3.org>.¶
XSLT 1.0 is not capable to directly emit the HTML doctype declaration, thus uses the SYSTEM ID "about:legacy-compat" instead (see Section 8.1.1 of [HTML5]).¶
When not run in a browser, the doctype declaration can be adjusted using a small script, such as with:¶
saxon test.xml rfc2629.xslt | awk -f html5doctype.awk
with¶
#!/usr/bin/awk -f # waitfordoctype: # 0: wait for line starting with DOCTYPE and eat empty lines # 1: wait for line starting with <html # 2: afterwards BEGIN { waitfordoctype = 0; } /<!DOCTYPE .*/ { if (waitfordoctype == 0) { waitfordoctype = 1 } } /<html.*/ { if (waitfordoctype == 1) { waitfordoctype = 2 printf("<!DOCTYPE html>\n") } else { print } } { if (waitfordoctype == 0 && $0 != "") { print } else if (waitfordoctype == 2) { print } }
LINK elements exist since HTML 2.0. They can be used to embed content-independant links inside the document. Unfortunately, only few user agents support this element. Firefox users may want to check the Link Widgets extension.¶
The following LINK elements are produced:
LINK type | description |
---|---|
alternate | for RFCs, a link to the authorative ASCII version on the IETF web site |
appendic | pointer to all top-level appendics |
author | pointer to "authors" section |
chapter | pointer to all top-level sections |
contents | pointer to table of contents |
copyright | pointer to copyright statement |
index | pointer to index |
The figure below shows how Mozilla Firefox 1.0 displays the Site Navigation Bar for rfc2396.xml.
The following standard HTML META elements are produced:
META name | description |
---|---|
generator | from XSLT engine version and stylesheet version |
keywords | from keyword elements in front section |
Unless turned off using the "rfc-ext support-rfc2731" processing instruction, the transformation will generate metadata according to [RFC2731] and [DC-HTML].¶
The following DCMI properties are produced:
META name | description |
---|---|
DC.Creator | from author information in front section |
DC.Date.Issued | from date information in front section |
DC.Description.Abstract | from abstract |
DC.Identifier | document URN [RFC2648] from "docName" attribute |
DC.isPartOf | RFC ISSN (for RFCs) |
DC.Relation.Replaces | from "obsoletes" attribute |
RFCs are immutable; once published, they do not change anymore. What does change though is their status, their relation to subsequent RFCs (such as when they are updated), and errata.¶
rfc2629toXHTML.xslt by default inserts code that will pull the relevant information from <https://tools.ietf.org>. This can be disabled by specifying the parameter "xml2rfc-ext-insert-metadata=no" (or by inserting the equivalent processing instruction into the source code).¶
An example for the generated information can be seen at <https://greenbytes.de/tech/webdav/rfc2616.html#rfc.meta>.¶
Unfortunately, the RFC Editor does not provide errata information in a well-defined machine readable format. What's available is "regular" HTML (and that could be the worst currently in use in standards bodies...).¶
parse-errata.xslt attempts to parse useful information out of these pages.¶
It can be run like that (requires an XSLT2 processor):¶
# get the raw html and strip form feed characters curl -s https://www.rfc-editor.org/errata_search.php?rfc=2616 \ | tr -d '\f' > rfc2616.rawerrata # regexps are your friend saxon97he parse-errata.xslt parse-errata.xslt doc=2616 > rfc2616.errata
The code tries to make sense of the HTML, in particular it tries to detect what RFC sections each erratum applies to. The resulting XML format is work-in-progress and just contains the information that will be useful in subsequent formatting of the RFC.¶
When formatting the RFC for HTML output, the errata file can be passed as stylesheet parameter ("xml2rfc-ext-errata"). The output will include errata links at the beginnings of the section they apply to, or at the beginning of Section 1 when the location is unknown.¶
For the sake of embedding, three types of errata are relevant; their type is indicated with a symbol:¶
To recap: the errata information is passed into the transformation as additional parameter. The errata information will not be automatically retrieved from the RFC Editor web site.¶
Finally, here's an example for inserted errata links: <https://greenbytes.de/tech/webdav/rfc7230.html#transfer.codings>.¶
Transforming to XHTML requires slightly different XSLT output options and is implemented by the derived transformation script rfc2629toXHTML.xslt.¶
To generate a CHM file using Microsoft's HTML Help Compiler (hhc), three files are required in addition to the HTML file. ¶
The three files are generated with three specific transformations, each requiring the additional XSLT parameter "basename" to specify the filename prefix.¶
Example:
saxon rfc2616.xml rfc2629toHhp.xslt basename=rfc2616 > rfc2616.hhp saxon rfc2616.xml rfc2629toHhc.xslt basename=rfc2616 > rfc2616.hhc saxon rfc2616.xml rfc2629toHhk.xslt basename=rfc2616 > rfc2616.hhk hhc rfc2616.hhp
Transformation to XSL-FO [XSL-FO] format is available through rfc2629toFO.xslt (which includes rfc2629.xslt, so keep both in the same folder).¶
Compared to HTML user agents, XSL-FO engines unfortunately either come as open source (for instance, Apache FOP) or feature-complete (for instance, AntennaHouse XSL Formatter), but not both at the same time.¶
As Apache FOP needs special workarounds (index generation), and some popular extensions aren't standardized yet, the translation produces a generic output (hopefully) conforming to [XSL-FO]. Specific backends (xsl11toFop.xslt, xsl11toXep.xslt, xsl11toAn.xslt) then provide post-processing for the individual processors.¶
Example:
saxon rfc2616.xml rfc2629toFo.xslt > tmp.fo saxon tmp.fo xsl11toFop.xslt > rfc2629.fo
PDF output can also be produced directly from (X)HTML. One simple approach is to rely on the browser's printing function, and to use a printer driver that produces PDF. Depending on the brower's CSS capabilities, the output will behave properly with respect to table breaks etc.¶
An alternative is PrinceXML (see <http://www.princexml.com/>), which can produce PDF directly from (X)HTML input, based on the CSS printing information.¶
For instance, PDF output with text justification turned on can be produced with:
saxon input.xml rfc2629.xslt > output.html prince output.html output.pdf
Experimental transformation to ePub format is available through a set of stylesheets, and the Unix Shell script mkepub.sh (which requires that "zip" and either "saxon" or "xsltproc" are installed).¶
For instance, an epub version of rfc2616.xml can be generated like this:
mkepub.sh rfc2616.xml
This section documents extensions implemented in rfc2629.xslt, using the extension namespace "http://purl.org/net/xml2rfc/ext".¶
Converts the contained quoted string into a hex-encoded character sequence, for use in case-sensitive ABNF productions.¶
For instance, "<x:abnf-char-sequence>"HTTP"</x:abnf-char-sequence>" gets converted to "%x48.54.54.50".¶
This element can be used to include a contributor's contact information in place where a paragraph (<t>) would be allowed otherwise.¶
The DOCTYPE definition below allows using these keywords using XML entity expansion: such as in "...server &MUST; accept...".
<!DOCTYPE rfc [ <!ENTITY MAY "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext' >MAY</bcp14>"> <!ENTITY MUST "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext' >MUST</bcp14>"> <!ENTITY MUST-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext' >MUST NOT</bcp14>"> <!ENTITY OPTIONAL "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext' >OPTIONAL</bcp14>"> <!ENTITY RECOMMENDED "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext' >RECOMMENDED</bcp14>"> <!ENTITY REQUIRED "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext' >REQUIRED</bcp14>"> <!ENTITY SHALL "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext' >SHALL</bcp14>"> <!ENTITY SHALL-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext' >SHALL NOT</bcp14>"> <!ENTITY SHOULD "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext' >SHOULD</bcp14>"> <!ENTITY SHOULD-NOT "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext' >SHOULD NOT</bcp14>">]>
Marking up a string as <bb> indicates that it represents the bottom line of a box drawing, replacing the "+" and "-" characters accordingly.¶
Marking up a string as <bc> indicates that it represents a center line of a box drawing, replacing the "|" character accordingly.¶
This element is like the <blockquote> element defined in Section 4.4.4 of [HTML5] (note this is a block-level element!). It should contain one or more <t> child elements.¶
Marking up a string as <bt> indicates that it represents the top line of a box drawing, replacing the "+" and "-" characters accordingly.¶
Contains mapping information for a single Unicode code points. Attributes are "c" (the actual character), "n" (the code point), and "d" (the name/description).¶
For instance:¶
<x:u-map> <x:c n="8364" c="€" d="EURO SIGN"/> <x:u-map>
(The format is deliberately terse so that the size of a mapping file containing the whole Unicode character database is minimized).¶
This element is like the <dfn> element defined in Section 4.5.8 of [HTML5].¶
This elements allows declaring a feedback link for document reviewers. The template string takes the form of a URI template, such as:¶
<x:feedback template="mailto:ietf-http-wg@w3.org?subject={docname},%20%22{section}%22&body=<{ref}>:"/>
where "docname" is substituted by the document name, "section" is substituted by section title (number and name), and "ref" is substituted by a URI pointing to the section being referenced.¶
Used to highlight text passages, currently only allowed in <artwork>.¶
Note: this is stripped when generating input for xml2rfc, so please use with care.¶
This element can be used to insert the length of another formatted section (in decimal).¶
Example: computing the Content-Length header value
<artwork> ... Content-Length: <x:length-of target="req"/> <x:span anchor="req">123456789 <x:span><artwork/>
The lenght computation counts line ends as two characters (CRLF).¶
Note that indentation characters in artwork will be counted. The "indented" attribute allows to specify the amount of indentation to be substracted from the computed length.¶
This element can be added as a top-level child element below <rfc> to indicate additional link information. It's currently used only when generating HTML output, in which case an HTML <link> element with identical attributes gets generated.¶
Example: generating HTML link element
<x:link xmlns:x="http://purl.org/net/xml2rfc/ext" rel="Bookmark" title="IETF WEBDAV Working Group" href="http://ftp.ics.uci.edu/pub/ietf/webdav/"/>
If the attribute "basename" is present, it is used to compute the target href based on the output format being generated (this is handy for "next"/"prev" links in a series of documents. In this case, the href attribute is not required.¶
For instance:
<x:link xmlns:x="http://purl.org/net/xml2rfc/ext" rel="next" title="Part2" basename="draft-foobar-protocol-p2-latest"/>
Used for grouping multiple <t> elements into a single list item.¶
Can be used to add a note, usually indented by a few characters. It should contain one or more <t> child elements.¶
This element instructs the processor to parse the contents as XML and to warn when there's a problem (requires either MSXML or Saxon8 or newer).¶
This element can be used inside <reference> to add plain text (before the date, when present).¶
See also <refcontent> (Section 12.16). ¶
This element is like the <q> element defined in Section 4.5.7 of [HTML5].¶
This element is a simplified variant of the <xref> element, in that no "target" attribute needs to be specified, instead the text contents acts as identifier. That in itself wouldn't be terribly useful, but together with the <anchor-alias>, it allows referring to other parts of the document with minimal additional markup.¶
For instance, given an alias definition such as¶
<section title="Test" anchor="test"> <x:anchor-alias value="alias1"/> <x:anchor-alias value="alias 2"/> ... </section>
the following simple references¶
<x:ref>test</x:ref> <x:ref>alias1</x:ref> <x:ref>alias 2</x:ref>
are equivalent to...:¶
<xref target="test">test</xref> <xref target="test">alias1</xref> <xref target="test">alias 2</xref>
Can be used to enhance a <reference> with information about the location for the XML source. This can be used by the <xref> processing code to automatically extract the target section number.¶
For example:
... <xref target="RFC2616" x:fmt="of" x:rel="#PUT" /> ... <reference target="RFC2616"/> ... <x:source href="rfc2616.xml"/> ...
This element is like the <sup> element in Section 4.5.16 of [HTML5].¶
Note: the down conversion to RFC7749 format replaces "xy" by "x^y".¶
See also <sup> (Section 12.24). ¶
Needed for the lookup of Unicode character database information; this element can either appear in-band in the source document, or off-band as specified using the xml2rfc-ext-ucd-file parameter/PI.¶
Contains multiple <x:c> elements (see Section 11.9).¶
The utility XSLT convert-ucd.xslt can be used to create a mapping file based on the Unicode XML database format, as available from <https://unicode.org/ucd/#UCDinXML>.¶
Sometimes, artwork occurs inside lists. To get it indent properly in xml2rfc's text output, it needs to be indented in the source. This is sub-optimal, as this whitespace will also appear in the HTML output, where it's already indented due to HTML's semantics. As a workaround, a "x:indent-with" attribute can be specified, containing a string that will be prepended to each line when clean-for-DTD.xslt is run (see Section 13.4).¶
Furthermore, documents can contain code that might need to be marked as "code component" (<http://www.ietf.org/iesg/statement/copyright.html>). This can be done using "x:is-code-component".¶
Finally, when allowing pretty-printing of code (see "html-pretty-print" in Section 3.3, the "x:lang" attribute can used to explicitly opt into pretty-printing. If the pretty printer can figure out the code type without assistance, an empty value will be sufficient. Otherwise, the language can be specified in the attribute (such as "html"), which will in turn be coded into the CSS class as "lang-" concatenated with the language name.¶
The attribute "x:include-day" ("true", "false") can be used to control whether the day-of-month should be included in the output. This can be used to adjust the rendering of dates for April-1st-RFCs to the desired special format, including the "1".¶
In particular: on the front page, the attribute defaults to "true", unless when generating RFCs. The output format also varies depending on RFC-ness: it's "day month year" for RFCs, but "month day, year" otherwise. In references, the attribute defaults to "false", and when set to true, the day is just inserted in front of the month.¶
The extension attribute below is allowed on the standard <iref> element: ¶
The extension attribute below is allowed on the standard <list> element: ¶
The extension attributes below are allowed on the standard <rfc> element: ¶
The extension attribute below is allowed on the standard <list> element: ¶
Three extension attributes are allowed on the standard <xref> element: ¶
The following formats are defined for the x:fmt attribute:¶
These extensions are currently only supported for <xref> elements without child nodes.¶
rfc2629.xslt experimentally supports some elements from the "V3" vocabulary, defined in [RFC7991bis]. This support is experimental, as the "v3" vocabulary is still being developed. ¶
See Section 3.1.1 of [V3IMPNOTES].¶
See Section 2.6 of [RFC7991bis].¶
See Section 2.9 of [RFC7991bis].¶
See Section 2.10 of [RFC7991bis].¶
See Section 2.10 of [RFC7991bis].¶
See Section 2.18 of [RFC7991bis].¶
See Section 2.17 of [RFC7991bis].¶
See Section 2.19 of [RFC7991bis].¶
See Section 2.20 of [RFC7991bis].¶
See Section 2.21 of [RFC7991bis].¶
See Section 2.28 of [RFC7991bis].¶
See Section 2.29 of [RFC7991bis].¶
See Section 2.31 of [RFC7991bis]. Currently only supported inside <references> and <section>.¶
See Section 2.33 of [RFC7991bis].¶
See Section 2.37 of [RFC7991bis].¶
See Section 2.38 of [RFC7991bis].¶
See Section 2.40 of [RFC7991bis].¶
See Section 2.43 of [RFC7991bis].¶
EXPERIMENTAL, might be removed again - see <https://github.com/rfc-format/draft-iab-xml2rfc-v3-bis/issues/26>. ¶
See Section 2.47 of [RFC7991bis].¶
See Section 2.39 of [RFC7991bis].¶
See Section 2.39.2 of [RFC7991bis].¶
See Section 2.45 of [RFC7991bis].¶
See Section 2.45.2 of [RFC7991bis].¶
See Section 2.45.3 of [RFC7991bis].¶
See Section 2.49 of [RFC7991bis].¶
See Section 2.50 of [RFC7991bis].¶
See Section 2.51 of [RFC7991bis].¶
See Section 4 of [RFC7991bis].¶
See Section 2.53 of [RFC7991bis].¶
See Section 2.54 of [RFC7991bis].¶
See Section 2.55 of [RFC7991bis].¶
See Section 2.56 of [RFC7991bis].¶
See Section 2.57 of [RFC7991bis].¶
See Section 2.58 of [RFC7991bis].¶
See Section 2.60 of [RFC7991bis].¶
See Section 2.61 of [RFC7991bis].¶
See Appendix A.1 of [V3IMPNOTES].¶
Note that in this implementation, this element needs mapping information in two cases:¶
The mapping information can be supplied inline using the <x:u-map> element, or in an external file. See Section 11.24 for details.¶
See Section 2.62 of [RFC7991bis].¶
See Appendix B.1 of [RFC7991bis].¶
EXPERIMENTAL and INCOMPLETE - only supported as a child element of <references>, and only supporting parse type "XML". ¶
check-references.xslt can be used to check all references to RFC- and ID-series IETF publications and to W3C publications (note this script requires local copies of <ftp://ftp.isi.edu/in-notes/rfc-index.xml> and <http://www.w3.org/2002/01/tr-automation/tr.rdf> and will use the XML status information provided at <http://tools.ietf.org/>).¶
If the document is supposed to be published on the IETF standards track, the desired level can be specified using the parameter intended-level as 'proposed', 'draft' or 'internet'. Alternatively, it can be specified inside the document using the attribute x:maturity-level on the <rfc> element (see Section 11.29).¶
Note: Downward references should be annotated using the <annotate> element, containing an <xref> to [BCP97].¶
When an XSLT 2.0 processor is used, links in the document can be checked as well using the link-check parameter ('yes' or 'no'). Note that this only works for http links to documents of type text/*.¶
For instance, as of 2008-07-12, the script produces for <https://greenbytes.de/tech/webdav/rfc2518.xml>:
> saxon rfc2518.xml check-references.xslt intended-status=PROPOSED \ link-check=yes Normative References: ISO-11578: not checked ISO-639: not checked ISO-8601: not checked REC-xml-19980210: [FirstEdition] obsoleted by REC-xml-20001006 REC-xml-names-19990114: [FirstEdition] obsoleted by REC-xml-names-20060816 RFC1766: [PROPOSED STANDARD] obsoleted by RFC3066 RFC3282 RFC2068: [PROPOSED STANDARD] obsoleted by RFC2616 RFC2069: [PROPOSED STANDARD] obsoleted by RFC2617 RFC2119: [BEST CURRENT PRACTICE] (-> BCP0014) ok RFC2141: [PROPOSED STANDARD] ok RFC2277: [BEST CURRENT PRACTICE] (-> BCP0018) ok RFC2396: [DRAFT STANDARD] obsoleted by RFC3986 RFC2279: [DRAFT STANDARD] obsoleted by RFC3629 Informational References: REC-PICS-labels-961031: [REC] ok RFC1807: [INFORMATIONAL] ok RFC2026: [BEST CURRENT PRACTICE] (-> BCP0009) ok RFC2291: [INFORMATIONAL] ok RFC2376: [INFORMATIONAL] obsoleted by RFC3023 RFC2413: [INFORMATIONAL] obsoleted by RFC5013 USMARC: not checked WF: not checked Link Targets <http://www.w3.org/TR/1998/REC-xml-19980210>: ok <http://www.w3.org/TR/1999/REC-xml-names-19990114>: ok <http://www.dlib.org/dlib/july96/lagoze/07lagoze.html>: ok <http://www.w3.org/pub/WWW/TR/REC-PICS-labels-961031.html>: ok
Recognized formats in the <seriesInfo> element are: ¶
gen-reference-graph.xslt generates a graph of RFC dependencies, using the same base data as in check-references.xslt (see Section 13.1). Its output is a "dot" file, to be processed by GraphViz (see <http://www.graphviz.org/>).¶
The picture below shows the RFC dependencies in RFC2629.
amazon-asin.xslt uses the Amazon web services to generate a <reference> element for a given ASIN (ISBN).¶
For instance:
<?xml version="1.0" encoding="utf-8"?> <references> <reference target="urn:isbn:0134516591"> <front> <title>Simple Book, The: An Introduction to Internet Management, Revised Second Edition</title> <author surname="Rose" fullname="Marshall T. Rose" initials="M. T. "> <organization/> </author> <author surname="Marshall" fullname="Rose T. Marshall" initials="R. T."> <organization/> </author> <date year="1996" month="March"/> </front> <seriesInfo name="Prentice Hall" value=""/> </reference> </references>
Note that the resulting XML usually requires checking, in this case Amazon's database is playing tricks with Marshall's name...¶
clean-for-DTD.xslt can be used to down-convert some extensions to a format that is supported by the existing xml2rfc formatters, mainly for the purpose of generating plain-text output. Note that these extensions are experimental (feedback appreciated).¶
The following mappings are done: ¶
As the output formatters evolve to support the V3 format (proposed in [RFC7991bis]), clean-for-DTD.xslt will start taking advantage of these changes. Right now, it supports three modes, one of which being used for the historic TCL processor, and the other ones being used with xml2rfc 2.5.2 and xml2rfc 2.6.0 (see https://pypi.python.org/pypi/xml2rfc/).¶
The modes can be selected using the xml2rfc-ext-xml2rfc-backend parameter or the rfc-ext/xml2rfc-backend processing instruction. The default mode is "201610" for documents with a publication date between January and May 2017, "201706" for documents newer than May 2017, and "201510" otherwise:¶
With extract-artwork.xslt, artwork elements named through the "name" attribute can be extracted. This can be used to automatically check their syntax (for instance, when ABNFs appear within a figure element).¶
For instance:
saxon rfc3986.xml extract-artwork.xslt name=uri.abnf
In addition, artwork of a specific type can be extracted, such as with:¶
saxon rfc3986.xml extract-artwork.xslt type=abnf
When extracting by type, artwork elements with a specified name can be excluded; this can be handy when the document uses some kind of schema language, and an appendix contains the collected schema, repeating definitions from earlier on. Example:¶
saxon rfc3986.xml extract-artwork.xslt type=abnf except-name=clschm
rfc2629grddl.xslt extracts RDF information. This is experimental work-in-progress. See <http://www.w3.org/TR/grddl/> for more information.¶
Experimental ¶
The "HTML Live Refresh" mode allows to run a text editor and a browser side-by-side, with the browser auto-updating every few seconds, displaying the updated HTML, and automatically navigating to the part of the page that changed last.¶
The requirements for this mode are:¶
This feature is currently tested with:¶
Use of this feature requires the inclusion of a processing instruction that holds the name of the XML source, such as:¶
<?rfc-ext refresh-from="draft-foo-bar-00.xml"?>
The optional parameters refresh-interval and refresh-xslt support changing the refresh interval (in seconds, defaulting to 10), and the name of the XSLT file to use (defaulting to "rfc2629.xslt").¶
To test this feature, start with a minimal source file like this:
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt'?> <?rfc-ext refresh-from="draft-foo-bar-00.xml"?> <rfc docName="draft-foo-bar-00" ipr="trust200902"> <front> <title>Title Goes Here</title> <abstract> <t>Abstract</t> </abstract> </front> </rfc>
...open it in both text editor and browser, start editing and of course ocasionally save. And don't forget to put rfc2629.xslt into the same folder.
There are many methods for automatic inclusion of material in the XML source, such as the "include" processing instruction (see Section 3.1), external entities (Appendix C.1), or XInclude. In general, those share a common problem: the XML source file isn't self-contained, which makes it harder to submit it as Internet Draft.¶
The tool refresh-inclusions.sh does in-place replacement: it scans the source file for inclusion directives (expressed as XML processing instructions), and refreshes the included text with data from an external file. It will not modify the source file unless included material did actually change. When it does modify the source file, it will copy the original source to a backup file.¶
refresh-inclusions.sh can include both plain text (BEGINESCAPEDINC/ENDESCAPEDINC) and XML (BEGININC/ENDINC). The figure below was inserted using:¶
<?BEGINESCAPEDINC refresh-inclusions.sh ?> ... <?ENDSCAPEDINC refresh-inclusions.sh ?>
(note that the SP character at the end of the directive is significant)
refresh-inclusions.sh:
#!/bin/sh # Refresh file inclusions based on XML processing instructions # # Copyright (c) 2006-2016, Julian Reschke (julian.reschke@greenbytes.de) # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # * Neither the name of Julian Reschke nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. expand() { # remember whether we started with CRLF (assumes that we have dos2unix) CRLF=$(dos2unix -ic "$1" 2>/dev/null | tr -d ' ') cat "$1" | awk ' function filecontents(filename) { while (getline < filename > 0) { fc[filename] = fc[filename] $0 "\n" } return fc[filename] } BEGIN { includefile = ""; includeescapedfile = ""; } # start include (verbatim mode) /<\?BEGININC .* \?>$/ { print keyword = "<?BEGININC " extract = match($0, /<\?BEGININC .* \?>$/) includefile = substr($0, RSTART + length(keyword), RLENGTH - 3 - length(keyword)) output = filecontents(includefile) printf("%s", output) } # start include (escape-for-XML mode) /<\?BEGINESCAPEDINC .* \?>$/ { print keyword = "<?BEGINESCAPEDINC " extract = match($0, /<\?BEGINESCAPEDINC .* \?>$/) includeescapedfile = substr($0, RSTART + length(keyword), RLENGTH - 3 - length(keyword)) output = filecontents(includeescapedfile) # escape ampersand, less-than, and greater-than # when part of a CDATA end marker gsub(/&/, "\\&", output) gsub(/</, "\\<", output) gsub(/]]>/, "]]\\>", output) printf("%s", output) } # end include (verbatim mode) /^<\?ENDINC .* \?>/ { if ($2 != includefile) { printf ("unexpected ENDINC, got %s but expected %s\n", $2, includefile) >> "/dev/stderr" } includefile = ""; } # end include (escape-for-XML mode) /^<\?ENDESCAPEDINC .* \?>/ { if ($2 != includeescapedfile) { printf ("unexpected ENDESCAPEDINC, got %s but expected %s\n", $2, includeescapedfile) >> "/dev/stderr" } includeescapedfile = ""; } #default { if (includefile == "" && includeescapedfile == "") { print } } END { if (includefile != "") { printf ("missing ENDINC for %s\n", includefile) >> "/dev/stderr" } if (includeescapedfile != "") { printf ("missing ENDESCAPEDINC for %s\n", includeescapedfile) >> "/dev/stderr" } } ' > $$ # restore CRLF if needed if [ -n "$CRLF" ]; then FNN=$(echo "$1" | tr -d ' ') [ "$FNN" = "$CRLF" ] && unix2dos -q $$ fi # check for changes cmp -s "$1" $$ || ( cp -v "$1" "$1".ri.bak cp $$ "$1" echo "$1" updated ) rm -f $$ } [ $# -ne 0 ] || ( echo "refresh-inclusions.sh file..." >&2 ; exit 2 ) for i in $* do expand $i done
The RelaxNG schema ([RNC]) below can be used to validate input documents (for instance, with Jing).¶
Note that this is work in progress, and doesn't yet cover all extensions completely. ¶
# WORK IN PROGRESS! PLEASE REPORT PROBLEMS TO THE AUTHOR. # Define our extension namespace namespace x = "http://purl.org/net/xml2rfc/ext" # Define GRDDL namespace namespace grddl = "http://www.w3.org/2003/g/data-view#" # Define RDF namespace namespace rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#" # Define SVG namespace namespace svg = "http://www.w3.org/2000/svg" # Define XInclude namespace namespace xi = "http://www.w3.org/2001/XInclude" # Include rfc2629bis RNC grammar include "rfc2629.rnc" { # Redefine <annotation> to allow more markup annotation = element annotation { attlist.annotation, (TEXT | xref | eref | iref | cref | spanx | v3_tt )* } # Redefine <artwork> to allow markup artwork = element artwork { attlist.artwork, attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) ( v3_svg | (TEXT | eref | iref | spanx | xref | v3_em | v3_strong | x_abnf-char-sequence | x_bb | x_bc | x_bcp14 | x_bt | x_highlight | x_length-of | x_parse-xml | x_ref | x_span | x_x)* ) } # Redefine <back> to allow displayreference back = element back { attlist.back, v3_displayreference*, references*, section* } # Redefine <c> to allow our extension elements c = element c { attlist.c, (TEXT | xref | eref | iref | cref | spanx | v3_em | v3_strong | v3_tt | x_ref)* } # Redefine <cref> to allow more child elements cref = element cref { attlist.cref, (TEXT | eref | xref | x_ref)* } # Redefine <figure> to allow more child elements figure = element figure { attlist.figure, attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) v3_name?, iref*, preamble?, (artwork | v3_sourcecode | v3_artset ), postamble? } # Redefine <front> to allow boilerplate front = element front { attlist.front, title, seriesInfo*, author+, date?, area*, workgroup*, keyword*, abstract?, note*, v3_boilerplate? } # Redefine <list> element to allow <x:lt> child elements \list = element list { attlist.list, (t+ | x_lt+) } # Redefine <note> to allow <name> and not require title attribute note = element note { attlist.x_note, v3_name?, (v3_dl | v3_ol | t | v3_ul)+ } # Redefine <preamble> to allow our extension elements preamble = element preamble { attlist.preamble, (TEXT | xref | eref | iref | cref | spanx | v3_em | v3_strong | v3_tt | x_anchor-alias | x_bcp14)* } # Redefine <postal> to allow <postalLine> postal = element postal { ( (city | code | country | region | street)* | v3_postalLine+) } # Redefine <postamble> to allow our extension elements postamble = element postamble { attlist.postamble, (TEXT | xref | eref | iref | cref | spanx | v3_em | v3_strong | v3_tt | x_bcp14)* } # Redefine <reference> to allow our extension elements reference = element reference { attlist.reference, ( ( front, v3_refcontent?, seriesInfo*, x_prose?, v3_refcontent?, format*, annotation*, x_source? ) | ( v3_refcontent?, seriesInfo*, x_prose?, v3_refcontent?, format*, annotation*, x_source ) ) } # Redefine <references> to allow extension elements and attributes references = element references { attribute title { text }?, attribute anchor { xsd:ID }?, attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) v3_name?, (references+ # (see [V3IMPNOTES], Section 3.1.16) | (reference | v3_referencegroup | xi_include)+ ) } # Redefine <rfc> to allow our extension elements rfc = element rfc { attlist.rfc, v3_link*, x_link*, x_feedback?, x_assign-section-number*, front, middle, back? } # Redefine <section> to allow new elements section = element section { attlist.x_section, (t | artwork | figure | texttable | iref | section | v3_artset | v3_aside | v3_blockquote | v3_dl | v3_name | v3_ol | v3_sourcecode | v3_table | v3_ul | x_anchor-alias | x_blockquote | x_contributor | x_include-author | x_note | x_u-map | rdf_Description)* } # Redefine <spanx> to allow some markup spanx = element spanx { attlist.spanx, (TEXT | iref | xref | x_ref)* } # Redefine <t> to allow our extension elements t = element t { attlist.t, (TEXT | \list | figure | xref | eref | iref | cref | spanx | vspace | v3_bcp14 | v3_em | v3_relref | v3_strong | v3_sub | v3_sup | v3_tt | v3_u | x_abnf-char-sequence | x_anchor-alias | x_bcp14 | x_dfn | x_h | x_q | x_ref | x_span | x_sup)* } } # Extend attribute set for <abstract> attlist.abstract &= attribute pn { text }? # (see [RFC7991bis], Appendix B.2) # Allow extension attributes on <artwork> (Section 11.25) attlist.artwork &= attribute anchor { xsd:ID }?, attribute originalSrc { text }?, # (see [RFC7991bis], Appendix B.3) attribute x:indent-with { ATEXT }?, attribute x:lang { "" }?, attribute x:is-code-component { "no" | "yes" }? # Allow anchor and x:annotation attributes on <author> attlist.author &= attribute asciiFullname { ATEXT }?, attribute asciiInitials { ATEXT }?, attribute asciiSurname { ATEXT }?, attribute anchor { xsd:ID }?, attribute x:annotation { ATEXT }? # Extend attribute set for <c> attlist.c &= attribute anchor { xsd:ID }? # Extend attribute set for <city> attlist.city &= attribute ascii { ATEXT }? # Extend attribute set for <code> attlist.code &= attribute ascii { ATEXT }? # Extend attribute set for <country> attlist.country &= attribute ascii { ATEXT }? # Extend attribute set for <date> (see Section 11.26) attlist.date &= attribute x:include-day { "false" | "true" }? # Extend attribute set for <iref> (see Section 11.27) attlist.iref &= attribute x:for-anchor { ATEXT }? # Extend attribute set for <list> (see Section 11.28) attlist.list &= attribute x:indent { ATEXT }? # Extend/Relax attribute set for <note> attlist.x_note &= attribute anchor { xsd:ID }?, attribute title { ATEXT }?, attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) attribute removeInRFC { "false" | "true" }? # see Section 12.21.2 # Extend attribute set for <preamble> attlist.preamble &= attribute anchor { xsd:ID }? # Extend attribute set for <organization> attlist.organization &= attribute ascii { ATEXT }?, attribute showOnFrontPage { "false" | "true" }? # Extend attribute set for <reference> attlist.reference &= attribute quoteTitle { "false" | "true" }?, # (see Section 12.20.1) attribute xml:base { text }? # (see [RFC7991bis], Section 2) # Extend attribute set for <references> attlist.references &= attribute pn { text }? # (see [RFC7991bis], Appendix B.2) # Extend attribute set for <region> attlist.region &= attribute ascii { ATEXT }? # Extend attribute set for <rfc> attlist.rfc &= attribute grddl:transformation { ATEXT }?, attribute x:maturity-level { "proposed" | "draft" | "internet" }?, attribute indexInclude { "true" | "false" }?, # (see [RFC7991bis], Section 2.44.4) attribute tocDepth { text }?, # (see [RFC7991bis], Section 2.44.14) attribute tocInclude { "true" | "false" }?, # (see [RFC7991bis], Section 2.44.15) attribute scripts { text }?, # (see [RFC7991bis], Appendix B.3) attribute sortRefs { "true" | "false" }?, # (see [RFC7991bis], Section 2.44.11) attribute symRefs { "true" | "false" }?, # (see [RFC7991bis], Section 2.44.13) attribute version { text }? # (see [RFC7991bis], Section 2.44.13) # Extend/Relax attribute set for <section> (see Section 11.30) attlist.x_section &= attribute anchor { xsd:ID }?, attribute title { ATEXT }?, attribute toc { "include" | "exclude" | "default" }?, attribute numbered { "false" | "true" }?, # see Section 12.21.1 attribute removeInRFC { "false" | "true" }?, # see Section 12.21.2 attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) attribute x:fixed-section-number { ATEXT }? # Allow anchor attribute on <spanx> attlist.spanx &= attribute anchor { xsd:ID }? # Extend attribute set for <street> attlist.street &= attribute ascii { ATEXT }? # Extend attribute set for <c> (see Section 11.27) attlist.t &= attribute keepWithNext { text }?, attribute keepWithPrevious { text }?, attribute pn { text }? # (see [RFC7991bis], Appendix B.2) # Extend attribute set for <texttable> attlist.texttable &= attribute x:caption-side { ATEXT }? # Extend attribute set for <title> attlist.title &= attribute ascii { ATEXT }?, attribute x:quotes { "true" | "false" }? # (deprecated, see Section 12.20.1)) # Allow annotation attribute on <uri> attlist.uri &= attribute x:annotation { ATEXT }? # Extend attribute set for <xref> (see Section 11.31) attlist.xref &= attribute derivedContent { text }?, # (see [RFC7991bis], Appendix B.3) attribute x:fmt { "()" | "," | "of" | "number" | "sec" | "none" }?, attribute x:rel { ATEXT }?, attribute x:sec { ATEXT }? # Set of artwork (see Section 12.1) v3_artset = element artset { attribute anchor { xsd:ID }?, attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) artwork+ } # Side Note (see Section 12.2) v3_aside = element aside { attribute anchor { xsd:ID }?, attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) t+ } # BCP14/RFC2119 keywords (see Section 12.3) v3_bcp14 = element bcp14 { "MAY" | "MUST" | "MUST NOT" | "NOT RECOMMENDED" | "OPTIONAL" | "RECOMMENDED" | "REQUIRED" | "SHALL" | "SHALL NOT" | "SHOULD" | "SHOULD NOT" } # Blockquote (see Section 12.4) v3_blockquote = element blockquote { attribute anchor { xsd:ID }?, attribute cite { URI }?, attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) attribute quotedFrom { ATEXT }?, ( (artwork | v3_dl | figure | v3_ol | v3_sourcecode | t | v3_ul)+ | (TEXT | v3_bcp14 | cref | v3_em | eref | iref | v3_strong | v3_sub | v3_sup | v3_tt | xref)+ ) } # Boilerplate (see Section 12.4) v3_boilerplate = element boilerplate { attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) section+ } # Mapping of reference names to display names (see Section 12.6) v3_displayreference = element displayreference { attribute target { xsd:IDREF }, attribute to { ATEXT } } # Definition List Description Element (see Section 12.7) v3_dd = element dd { attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) ((v3_artset | artwork | figure | t | v3_dl | v3_ol | v3_sourcecode | v3_ul)+ | (TEXT | cref | eref | iref | xref | v3_em | v3_tt | v3_strong | v3_u)* ) } # Definition List (see Section 12.8) v3_dl = element dl { attribute indent { text }?, attribute newline { "false" | "true" }?, attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) attribute spacing { "normal" | "compact" }?, (v3_dt, v3_dd)+ } # Definition List Description Term (see Section 12.9) v3_dt = element dt { attribute anchor { xsd:ID }?, attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) (TEXT | cref | eref | iref | xref | v3_em | v3_tt | v3_strong)* } # Emphasized Text (see Section 12.10) v3_em = element em { (TEXT | xref | v3_strong | x_ref)* } # Definition List (see Section 12.11) v3_li = element li { attribute anchor { xsd:ID }?, attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) ((v3_artset | artwork | figure | v3_blockquote | v3_dl | v3_ol | t | v3_sourcecode | v3_ul )+ | (TEXT | cref | eref | iref | xref | v3_bcp14 | v3_em | v3_strong | v3_sub | v3_sup | v3_tt | v3_u | x_ref)* ) } # Container for additional links (see Section 12.12) v3_link = element link { attribute href { text }, attribute rel { text }? } # Section/Figure/Table Name (see Section 12.13) v3_name = element name { attribute slugifiedName { text }?, # (see [RFC7991bis], Appendix B.2) (TEXT | cref | v3_em | v3_tt | xref)* } # Ordered List (see Section 12.14) v3_ol = element ol { attribute anchor { xsd:ID }?, attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) attribute start { TEXT }?, attribute group { TEXT }?, attribute type { TEXT }?, v3_li+ } # Line in postal address (see Section 12.15) v3_postalLine = element postalLine { attribute ascii { TEXT }?, TEXT } # EXPERIMENTAL DO NOT USE YET (see Section 12.18) v3_relref = element relref { attribute derivedLink { text }?, # (see [RFC7991bis], Appendix B.3) attribute displayFormat { "of" | "comma" | "parens" | "bare" }?, attribute relative { text }?, attribute section { text }, attribute target { xsd:IDREF }, TEXT } # additional content for references (see Section 12.16) v3_refcontent = element refcontent { (TEXT | v3_em)* } # reference group (see Section 12.17) v3_referencegroup = element referencegroup { attribute anchor { xsd:ID }, attribute target { URI }?, (reference | xi_include)+ } # Source Code (see Section 12.19) v3_sourcecode = element sourcecode { attribute anchor { xsd:ID }?, attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) attribute markers { text }?, #(see [V3IMPNOTES], Section 3.1.22) attribute name { text }?, attribute type { text }?, attribute x:lang { "" }?, TEXT } # Emphasized Text (see Section 12.22) v3_strong = element strong { attribute anchor { xsd:ID }?, (TEXT | xref | v3_em | x_ref)* } # Subscript (see Section 12.23) v3_sub = element sub { (TEXT)* } # Superscript (see Section 12.24) v3_sup = element sup { (TEXT)* } # Table (see Section 12.26) v3_table = element table { attribute anchor { xsd:ID }?, attribute align { "left" | "center" | "right" }?, attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) v3_name?, iref*, v3_thead?, v3_tbody, v3_tfoot? } # Table Body (see Section 12.27) v3_tbody = element tbody { attribute anchor { xsd:ID }?, attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) v3_tr+ } # Table Contents Cell (see Section 12.28) v3_td = element td { attribute anchor { xsd:ID }?, attribute align { "left" | "center" | "right" }?, attribute colspan { text }?, attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) attribute rowspan { text }?, ( (t | v3_dl | v3_ol | v3_sourcecode | v3_ul )+ | (TEXT | v3_bcp14 | cref | v3_em | eref | v3_strong | v3_sub | v3_sup | v3_tt | xref)* ) } # Table Footer (see Section 12.29) v3_tfoot = element tfoot { attribute anchor { xsd:ID }?, attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) v3_tr } # Table Header Cell (see Section 12.30) v3_th = element th { attribute anchor { xsd:ID }?, attribute align { "left" | "center" | "right" }?, attribute colspan { text }?, attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) attribute rowspan { text }?, ( (t | v3_dl | v3_ol | v3_sourcecode | v3_ul )+ | (TEXT | v3_bcp14 | cref | v3_em | eref | v3_strong | v3_sub | v3_sup | v3_tt | xref)* ) } # Table Head (see Section 12.31) v3_thead = element thead { attribute anchor { xsd:ID }?, attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) v3_tr+ } # Table Row (see Section 12.32) v3_tr = element tr { attribute anchor { xsd:ID }?, attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) ( v3_td | v3_th )+ } # Monospaced Text (see Section 12.33) v3_tt = element tt { (TEXT | xref | v3_em | x_ref)* } # Non-ASCII characters (see Section 12.34) v3_u = element u { attribute ascii { text }?, attribute format { text }?, TEXT } # Unordered List (see Section 12.35) v3_ul = element ul { attribute anchor { xsd:ID }?, attribute empty { TEXT }?, attribute pn { text }?, # (see [RFC7991bis], Appendix B.2) v3_li+ } # SVG (see Section 12.25) v3_svg = element svg:svg { (attribute * { text } | text | anySVGElement)* } anySVGElement = element svg:* { (attribute * { text } | text | anySVGElement)* } # Conversion to ABNF char sequence (see Section 11.1) x_abnf-char-sequence = element x:abnf-char-sequence { TEXT } # Aliasing of anchors (see Section 11.2) x_anchor-alias = element x:anchor-alias { attribute value { TEXT }, empty } # Contributor information (see Section 11.3) # (experimental) x_contributor = element x:contributor { attlist.author, organization?, address? } # Supply feedback links (see Section 11.11) x_feedback = element x:feedback { attribute template { TEXT }, empty } # Including Author information # (experimental) x_include-author = element x:include-author { attribute target { xsd:IDREF } } # Setting section numbers for internally generated sections # (experimental) x_assign-section-number = element x:assign-section-number { attribute builtin-target { "authors" }, attribute number { TEXT }, empty } # Bottom line of box drawing (see Section 11.5) x_bb = element x:bb { (TEXT | iref | xref | x_bb | x_bc | x_bt | x_ref)* } # Center line of box drawing (see Section 11.6) x_bc = element x:bc { (TEXT | iref | spanx | xref | x_bb | x_bc | x_bt | x_ref)* } # BCP14/RFC2119 keywords (see Section 11.4) x_bcp14 = element x:bcp14 { "MAY" | "MUST" | "MUST NOT" | "NOT RECOMMENDED" | "OPTIONAL" | "RECOMMENDED" | "REQUIRED" | "SHALL" | "SHALL NOT" | "SHOULD" | "SHOULD NOT" } # Blockquote (see Section 11.7) x_blockquote = element x:blockquote { attribute anchor { xsd:ID }?, attribute cite { URI }?, t+ } # Top line of box drawing (see Section 11.8) x_bt = element x:bt { (TEXT | iref | xref | x_bb | x_bc | x_bt | x_ref)* } # Unicode character map entry (see Section 11.9) x_c = element x:c { attribute c { TEXT }, attribute d { TEXT }?, attribute n { TEXT } } # declaration of definition in external reference x_defines = element x:defines { TEXT } # Definition (see Section 11.10) x_dfn = element x:dfn { attribute anchor { xsd:ID }?, (TEXT | iref)* } # Heading (see Section 11.12) x_h = element x:h { TEXT } # Heading (see Section 11.13) x_highlight = element x:highlight { TEXT } # Length Measurement (see Section 11.14) x_length-of = element x:length-of { attribute indented { NUMBER }?, attribute target { xsd:IDREF }, empty } # Link (see Section 11.15) x_link = element x:link { attribute basename { URI }?, attribute href { URI }?, attribute title { TEXT }?, attribute rel { TEXT }, empty } # Extended list item (see Section 11.16) x_lt = element x:lt { attribute anchor { xsd:ID }?, attribute hangText { TEXT }?, t+ } # Note (see Section 11.17) x_note = element x:note { attribute anchor { xsd:ID }?, t+ } # Signal XML content (see Section 11.18) x_parse-xml = element x:parse-xml { (TEXT | xref)* } # Inline prose in a reference (see Section 11.19) x_prose = element x:prose { TEXT } # Inline quote (see Section 11.20) x_q = element x:q { TEXT } # Anchor reference (see Section 11.21) x_ref = element x:ref { attribute anchor { xsd:ID }?, TEXT } # source information (see Section 11.22) x_source = element x:source { attribute basename { ATEXT }?, attribute href { URI }, x_defines* } # superscript (see Section 11.23) x_sup = element x:sup { TEXT } # Inline Span x_span = element x:span { attribute anchor { xsd:ID }?, attribute x:lang { "" }?, (TEXT | x_parse-xml)* } # Unicode character map (see Section 11.24) x_u-map = element x:u-map { x_c* } # Nop (for alignment in source) x_x = element x:x { empty } # XInclude (see Section 12.36) xi_include = element xi:include { attribute href { text }, empty } # Embed RDF statements rdf_Description = element rdf:Description { rdf_content } rdf_content = ( TEXT | element * { rdf_content })*
Specific values in the <artwork> element's "type" attribute are recognized and cause a different visual style to be used:¶
Type | Comment |
---|---|
abnf | ABNF as per [RFC5234] |
abnf2045 | ABNF as per [RFC2045] |
abnf2616 | ABNF as per [RFC2616], Section 2.1 |
abnf7230 | ABNF as per [RFC7230], Section 1.2 |
application/relax-ng-compact-syntax | Relax NG Compact Syntax as per [RNC] |
application/xml-dtd | XML DTD |
code | monospaced text (with outline) |
drawing | drawing (with outline) |
example | monospaced text (with outline) |
image/* | images (to be used with "src" attribute) |
inline | monospaced text (no outline) |
message/http; msgtype="request" | HTTP message, as per [RFC7230], Section 8.3.1 |
message/http; msgtype="response" | HTTP message, as per [RFC7230], Section 8.3.1 |
pdu | pdu (with outline) |
svg and image/svg+xml | SVG |
The prolog of the XML document can both be used to refer to an external DTD, and also to define internal entities (Section 2.8 of [XML]):¶
<?xml version="1.0"?> <?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?> <!DOCTYPE rfc SYSTEM "rfc2629.dtd" [ <!-- use "&MAY;" for a BCP 14 "MAY", see Section 11.4 --> <!ENTITY MAY "<bcp14 xmlns='http://purl.org/net/xml2rfc/ext'>MAY</bcp14>"> <!-- re-declare " " as code point 160 (non-breaking space) --> <!-- you may need this for UAs that do not read external DTDs --> <!ENTITY nbsp " "> <!-- allow later RFC2616 reference using "&rfc2616;" --> <!-- the data will be fetched from xml.resource.org --> <!ENTITY rfc2616 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2616.xml"> <!-- allow a custom reference using "&mydraft;" --> <!-- the data will be fetched from the same location as the source file --> <!ENTITY mydraft SYSTEM "reference.mydraft.xml"> ]>
Note: including entities from a remote site will not work in browsers due to the Same-Origin policy.
The XSLT code can be customized by creating a custom XSLT file that uses <xsl:import> to include the original code, and just overrides particular rules.¶
For instance, the code below overrides several attributes in rfc2629toFO.xslt, changing the color, spacing and font family for headers.
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:import href="rfc2629toFO.xslt"/> <xsl:attribute-set name="h1"> <xsl:attribute name="color">darkblue</xsl:attribute> <xsl:attribute name="font-family">sans-serif</xsl:attribute> <xsl:attribute name="space-before">24pt</xsl:attribute> </xsl:attribute-set> <xsl:attribute-set name="h2"> <xsl:attribute name="color">darkblue</xsl:attribute> <xsl:attribute name="font-family">sans-serif</xsl:attribute> <xsl:attribute name="space-before">18pt</xsl:attribute> <xsl:attribute name="space-after">3pt</xsl:attribute> </xsl:attribute-set> <xsl:attribute-set name="h3"> <xsl:attribute name="color">darkblue</xsl:attribute> <xsl:attribute name="font-family">sans-serif</xsl:attribute> <xsl:attribute name="space-before">16pt</xsl:attribute> <xsl:attribute name="space-after">2pt</xsl:attribute> </xsl:attribute-set> </xsl:transform>
Various attributes of the <rfc> element plus some child elements of <front> affect the automatically generated parts of the front page, such as the tabular information at the beginning, the "Status Of This Memo", and the "Copyright Notice".¶
When submitting an Internet Draft, this "boilerplate" is checked by "Idnits" (<http://tools.ietf.org/tools/idnits/>) for compliance with the current Intellectual Property rules, and thus it is important to set the correct values.¶
Furthermore, the RFC Production Center uses RFC7749-based tools to generate the final RFC text, so the more accurate the supplied information is, the less additional work is left, and the risk for errors in producing the final (and immutable!) document is reduced.¶
The individual attributes on the <rfc> element are discussed in detail in Appendix A of [RFC7749].¶
Copyright (c) 2006-2018, Julian Reschke (julian.reschke@greenbytes.de)¶
All rights reserved.¶
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ¶
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.¶