Copyright ©2006 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark and document use rules apply.
The goal of Re-Spec is to provide a convenient framework in which to write specifications of various kinds but mostly orientated towards the W3C style. It does not claim or intend to be a perfect specification framework or better than other solutions such as XMLSpec [XMLSpec] or XHTML+classes. Simply, it has been created to suit the needs of its author, and perhaps those of like-minded individuals, assuming such entities even exist. It does, however, have a much cooler name than any of the other options.
Please note that some parts of this document are loosely described compared to what a proper specification would mandate. This is because here we are merely documenting how the one and only implementation of Re-Spec works, not specifying in order to make independent interoperable implementations. If you are interested in implementing Re-Spec differently from the current single implementation, please contact the author and I will tighten up this document.
A first pass at implementing the features below has been done but a fair number remains. The latter are identified by @TODO or @PARTIAL. The version of ReSpec documented here is 0.04.
The tool should know how to create a multipage document by splitting on the root sections, naming the pages based on the ID of that section, and know how to rewrite all the internal links so that they work (look for the ID, then its section ancestors, and point to that).
The links in the spec should only ever point to IDs, so that the XSLT can decide which extension to use.
Through the use of a sensible base stylesheet, it ought to be possible to produce new styles easily by overriding a minimal amount of templates.
RelaxNG should be embeddable straight into the specification, along with annotations that describe the elements and attributes, as well as ways to override the auto-generated description. The style of the RNG will have to be specific. The XSLT will then auto-generate descriptions of the element and attributes based on that. Weenies will want RNC, they get that option but later. The RNG may get some syntax highlighting.
Automatically any capitalized MUST, SHOULD, SHALL, MAY, possibly followed by a NOT will find themselves wrapped in an <rfc2119> element which'll be transformed into something nice by the XSLT.
Any occurence of an abbr or acronym element will cause a search so that all the other occurences of the same term that aren't marked up will be marked up.
Handling IDL is horrible. We will use an XML syntax that will fully describe the IDL and the spec prose, and that will be used to generate both the prose and the IDL snippets. The IDL may get some syntax highlighting. Or not. We might just parse the IDL using some code that has been written for SVG.
Based on the above, lists of elements, attributes, and interfaces can be generated if need be for the appendix.
If a glossary is defined, links will be auto-generated from occurences to it. This should ideally be done without elements to mark defined terms.
All the dependencies of a spec can be listed and then packed into a zip file and a tarball.
When being published a Re-Spec document will have its spelling, its pubrules-validity, and various other things validated. One thing that notably needs to be checked is that when an internal link to an anchor is created, it needs to exist.
Many specs tend to reuse always the same set of bibliographic references. Rather than having to always create or copy them anew, ReSpec provides a pre-existing database using the typical keys for those references. Simply using the square-bracket markup will cause the right entry to be added to the bibliography.
Each section can be categorised by normativity (reference, content, ua, discussion, etc.). Then a tool would expose present the various sections that have a given normativity (ua for test suite production, content for validation suite production) and in those split each sentence that it would present on separate lines. For each of those sentences one could say if it's a testable assertion or not, and if it is give it an ID. The tool would save that information in a separate document, using both the XPath relative to the closest ancestor with a given ID and the text of the sentence. This is to be used once the text is reasonably stable, but when reloading a document it would make a best effort to re-locate things that have changed. One could also associate TAs with tests, produce a coverage report, etc.
This section presents a rather simplified descriptions of the elements which are available for use within Re-Spec. The categories may not be the most intuitive in all cases.
All elements are in the http://berjon.com/ns/re-spec/
namespace, unless otherwise specified.
Most elements in this draft documentation don't have a corresponding RNG snippet yet. They'll get one as things go.
These elements define the backbone of the document.
This is the root element for all documents. The version attribute must be present and its value must currently be equal to "1.0". Note that this is not currently enforced.
Typically, it would contain one <metadata> element and several <section> elements.
The specification element
<define name='specification'> <element name='specification'> </element> </define>
The section element defines a section inside a specification, and can be nested to arbitrary depths. It must have an 'xml:id' attribute, may have a 'type' attribute, must have a <title> child, and may then contain a variety of XHTML block-level elements such as <p>, <ul>, or <table>.
The section element
<define name='section'> <element name='section'> </element> </define>
The 'type' attribute has a variety of predefined values with specific behaviours.
The title element is used to capture titles. Inside the <metadata> element it's the specification's title, inside other elements it applies directly to its parent element (<section>, <section>, <example>, <schema>, etc.).
While most of the time only its textual content will be used, for section titles the <at>, <pi>, <ev>, <prop>, and <el> elements will be processed specially.
The title element
<define name='title'> <element name='title'> </element> </define>
This is used to include other documents (which are not required to be ReSpec documents, they only need to be XML) with the 'href' attribute pointing relative to the document in which the element occurs. Future improvements will likely include the ability to have absolute links, respec: links, and to taking xml:base into account. Some XPointer schemes, notably the xpath scheme, may be considered as well.
Note that fragment identifiers will always be processed as if the linked document was of type application/xml, which is to say that the element with the given ID will be included. This is often used to include part of an external RelaxNG schema inside a <schema> element (this document does precisely that).
The include element
<define name='include'> <element name='include'> </element> </define>
This element is meant to flag that part of the document is an editorial note. This normally causes them to stick out strongly. Editorial notes are not normally meant for public consumption. It is possible that future versions will provide a flag to turn them on and off.
This element can contain pretty much anything else.
The ednote element
<define name='ednote'> <element name='ednote'> </element> </define>
The schema element is used to capture schemata. These can be of several types. Currently, RelaxNG is largely supported (at least for many simple RelaxNG constructs), EBNF is supported but will be extended, and IDL support is planned for very soon. The way the type is decided is by looking at the child elements. It should also contain a title child. XML Schema support may be added some day.
The schema element
<define name='schema'> <element name='schema'> </element> </define>
Inline elements are used to markup regular text in a variety of convenient ways.
This element is used to mark that its content is an attribute name. The 'el' attribute can be used to say that it's an attribute that belongs to that given element. The content must be an attribute name, and that only. A link will be generated to an ID as per the rules documented in the section on special identifiers.
The at element
<define name='at'> <element name='at'> </element> </define>
This element is used to mark that its content is an element name. The content must be an element name, and that only. A link will be generated to an ID as per the rules documented in the section on special identifiers.
The el element
<define name='el'> <element name='el'> </element> </define>
This element is used to mark that its content is an event name. The content must be an event name, and that only. A link will be generated to an ID as per the rules documented in the section on special identifiers.
The ev element
<define name='ev'> <element name='ev'> </element> </define>
This element is used to mark that its content is a PI name. The content must be a PI name, and that only. A link will be generated to an ID as per the rules documented in the section on special identifiers.
The pi element
<define name='pi'> <element name='pi'> </element> </define>
This element is used to mark that its content is a property name. The content must be a property name, and that only. A link will be generated to an ID as per the rules documented in the section on special identifiers.
The prop element
<define name='prop'> <element name='prop'> </element> </define>
These elements are used in the creation of bibliographies.
This is the root of a bibliography. Future versions may distinguish between normative and informative ones. It contains a series of <bibentry> elements.
If you wish to only use the bibliographic database without bothering to create the entries yourself, you can have an empty bibliography element to which the entries will get added at generation time. Please keep in mind though that the DB is currently somewhat limited (but I'm adding to it as I go).
The bibliography element
<define name='bibliography'> <element name='bibliography'> </element> </define>
Captures a single entry, or a group of entries that are commonly referred in most cases. If it is a single entry, the entry is described directly inside this element. If a group entry, then there may be several <p> elements introducing the group followed by several <entry> elements which will capture individual entries. The content model for the single entry version is described as part of the <entry> element.
It is required that there be an 'xml:id' attribute that corresponds exactly to the short name of the entry used in the specs' references.
The bibentry element
<define name='bibentry'> <element name='bibentry'> </element> </define>
Describes a single bibliographic entry. This is expected to have a <title>, a <link>, a <date>, and an <authors> element.
The entry element
<define name='entry'> <element name='entry'> </element> </define>
Contains a single IRI that is the link to that entry. Currently only online resources may be referenced in a bibliography.
The link element
<define name='link'> <element name='link'> </element> </define>
A variety of elements are available to describe what can be vaguely called metadata. They are not restricted to the metadata headers in the document but are also reused in other contexts such as bibliographic entries.
This is the header element for the entire specification. It contains a <title>, <styling> information, a <date>, and possibly <editors> and <authors>.
The metadata element
<define name='metadata'> <element name='metadata'> </element> </define>
Describing people is always a tricky business, and this set of elements is just about as ad hoc as many other attempts. It simply tries to capture what is normally used in specifications.
The <editors> and <authors> elements contain a list of <person> elements who are editors or authors of a specification or reference.
The <person> element describes an individual, and is rendered differently depending on its location. The various child elements that it may contain are <name> for the full name, <email> for that person's email, <url> for the person's IRI, <company> being the company that person works for, and <company-url> its IRI.
Elements describing people
<define name='editors'> <element name='editors'> </element> </define> <define name='authors'> <element name='authors'> </element> </define> <define name='person'> <element name='person'> </element> </define> <define name='company'> <element name='company'> </element> </define> <define name='company-url'> <element name='company-url'> </element> </define> <define name='url'> <element name='url'> </element> </define> <define name='email'> <element name='email'> </element> </define> <define name='name'> <element name='name'> </element> </define>
The date element contains three attributes for the year, month and day. The intent is to use it to generate dates in specification headers but it is not currently implemented. It is expected that this will be remedied very soon.
The date element
<define name='date'> <element name='date'> </element> </define>
The styling element contains metadata about the style of the specification. It's type attribute provides the type of the specification, a set currently limited to "W3C", "robin", and "Expway" but which can be extended.
The status attribute indicates the current status of the specification. This is currently mostly useful for the "W3C" type. The possible values are: ED (Editor's Draft), EDMO (the same, but Member-only), N (Note), INF (informal document), MO (Member-only informal document), WD, LC, CR, PR, and REC. I am aware that this does not capture all document types that can be produced within W3C and will be adding more as needed.
The styling element
<define name='styling'> <element name='styling'> </element> </define>
The <versions> element, contained inside the <metadata> element, is used to include pointers to multiple versions of the document. It is currently extremely ad hoc and it is expected that a better scheme will be provided in the close future. It contains three elements: <current>, <latest> and <previous>, the content of each of which is merely a link to the version being either the current, latest, or previous one.
Elements describing versions
<define name='versions'> <element name='versions'> </element> </define> <define name='current'> <element name='current'> </element> </define> <define name='latest'> <element name='latest'> </element> </define> <define name='previous'> <element name='previous'> </element> </define>
The following elements have been lifted as is from XHTML. For convenience their namespace is the ReSpec one: p, a, abbr, acronym, code, dl, dd, dt, ol, ul, li, table, thead, tbody, tfoot, caption, tr, th, td, em, strong, br.
All their attributes in no namespace are copied over as is. If they have an xml:id attribute (the only to be recognised as an ID inside ReSpec) the output will also have a matching id attribute.
Elements taken from XHTML
<define name='xhtml'> </define>
The following elements are described for completeness' sake, but are not actually available for use while editing ReSpec documents. They are automatically generated in the pre-processing phase of a ReSpec run, and the downstream XSLT then handles them. It may therefore be useful to XSLT authors to know about them.
Whenever an RFC 2119 [RFC2119] keyword in uppercase is found, it gets wrapped in this element.
The rfc2119 element
<define name='rfc2119'> <element name='rfc2119'> </element> </define>
Whenever a bibliographic reference is found, it is wrapped in this element (the square brackets are not removed, they are placed right before and right after the element).
The bibref element
<define name='bibref'> <element name='bibref'> </element> </define>
The one and only PI understood by the ReSpec processor is <?respec-toc?>.
This instructs the final step style sheet to generate a table of contents in place of the PI.
It is generally considered a bad idea to introduce new URI schemes, and the introduction of this one has been given extensive thought. In the end, I figured that since it would never be used in the wild but only within ReSpec documents (that are not meant for widespread distribution). When ReSpec documents are transformed, all mentions of the respec: scheme are removed.
The goal of this scheme is to provide locators for resources that are bundled with ReSpec, so that the ReSpec processor may access them easily. A typical use for this would be to specify an additional style sheet that ships with ReSpec and have it copied to the publish directory.
Currently, the only two sorts of resources that ReSpec knows to locate through this scheme are its CSS and XSLT style sheets. Simply provide the sheet's name and it will know where to look for it. This may be extended to include more resource types.
Links to the following special identifiers are generated for some various items in the grammar. More will be added for EBNF and IDL support. If you give this ID to a section, the <at>, <pi>, <ev>, <prop>, and <el> elements will then work correctly (NOTE: this is not always the case in this document which was written a little too fast).
Identifier | Description |
---|---|
prop-<name> |
Generated for properties, where <name> is the name of the property.
|
event-<name> |
Generated for events, where <name> is the name of the event. I haven't
yet thought of how to get that to work cleanly for namespaced events should we ever
need to describe events in multiple namespaces from within a single document.
|
elem-<name> |
Generated for elements, where <name> is the name of the element.
|
attr-<name> |
Generated for attributes, where <name> is the name of the attribute.
|
attr-<elem>-<name> |
Generated for attributes that are local to a given element, where <name>
is the name of the attribute and <elem> that of the element.
|
pi-<piname> |
Generated for processing instructions, where <piname> is the name of
the PI.
|
rng-<defname> |
Unlike the previous instances, this is not a generated link but rather a generated
anchor, so that using such an ID will cause duplicate IDs to be present in the document.
Needless to say, don't do that. Use this to link to RelaxNG schema snippets from the body
of the specification. Whenever the ReSpec processor finds a RelaxNG ref element,
it creates a link to the corresponding define .
|