Non-DITA XML Processing
Decoration
When a non-DITA XML document is processed, one of the first things TD will do is read
the
doctype's /HARP-META/doctype.xml
file and use its settings to add
namespaced attributes to the document. This will, in effect, make the document
self-describing for purposes of downstream processing.
The namespace prefixes added during the decoration process are as follows.
- @xmlns:td
http://www.titaniasoftware.com/ns/titania-delivery/decoration
- @xmlns:profiles
http://www.titaniasoftware.com/ns/titania-delivery/decoration/profiling
- Every element described in
/HARP-META/doctype.xml
gets a @td:role attribute describing its purpose. Elements described by <special> get the appropriate @type values. Other elements are described below. - If the configuration element specifies an @html-tag, the element will get a @td:html-tag attribute with that value.
- IDREF links get a @td:role of "link-idref". In addition, they get @td:linkendAttrs with the @linkend value.
- External links get a @td:role of "link-external" and @td:hrefAttrs with the @href value.
- Fileref links get @td:role="link-fileref" and @td:hrefAttrs value with the @href value.
- Graphics get @td:role=imageref and @td:hrefAttrs with the @src attribute value.
- Every element with an ID or language attribute as described in the config file gets @xml:id and @xml:lang, respectively.
- For every profiling attribute, the root element gets a @profiling:{attribute} attribute whose value is that profiling attribute's delimiter.
- Every element gets a @td:pointer attribute with the element name and
number, for comment traceability (e.g.
td:pointer="para:5"
for the fifth <para> element).
Once the document is decorated, downstream processing and styling can use the decorations to determine the appropriate processing and styling. Processing includes resolving links and graphics, and chunking the content at divisions.
Chunking
When working with non-DITA doctypes, elements identified as
type="division"
in doctype.xml
will be broken out
into their own discrete chunk. The chunk will be indexed as an individual document,
and
presented to portal users as its own web page. In the top-level document, the chunked
content will be replaced by generated ToC-style markup.
<?xml version="1.0" encoding="UTF-8"?> <td:toc td:role="unordered-list"> <td:tocentry td:role="list-item"> <td:toclink href="puckditaxref:preface-online" type="preface" td:role="link-fileref" td:hrefAttrs="href" targetId="preface-online">Preface to the DocBook V5.2 Edition</td:toclink> </td:tocentry> <td:tocentry td:role="list-item"> <td:toclink href="puckditaxref:preface" type="preface" td:role="link-fileref" td:hrefAttrs="href" targetId="preface">Preface</td:toclink> </td:tocentry> <td:tocentry td:role="list-item"> <td:toclink href="puckditaxref:docbook-intro" type="part" td:role="link-fileref" td:hrefAttrs="href" targetId="docbook-intro">Introduction</td:toclink> <td:toclevel td:role="unordered-list"> <td:tocentry td:role="list-item"> <td:toclink href="puckditaxref:ch-gsxml" type="chapter" td:role="link-fileref" td:hrefAttrs="href" targetId="ch-gsxml">Getting Started with DocBook </td:toclink> </td:tocentry> </td:toclevel> </td:tocentry> </td:toc>
- <td:toc>
- The root level of the table of contents with a @td:role of
unordered-list
. - <td:tocentry>
- Each chunk will be represented by a <td:tocentry> element
(
td:role="listitem"
. - <td:toclink>
- Within a <td:tocentry> there will be exactly one
<td:toclink> which is the link to the resolved chunk. When
styling for HTML, the @href attribute should be passed as-is to the
resulting <a> tag, and post-processing will resolve it
automatically. The content of the link will be the title of the chunk. It carries
these attributes.
- @type
- The name of the chunked element.
- @td:role
- link-fileref
- @td:hrefAttrs
- Names the @href attribute. The base stylesheet handles links automatically by determining the link target attribute from this attribute.
- @targetId
- The ID attribute value on the chunked element. This value will be generated when the chunk doesn't already carry an ID.
- <td:toclevel>
- When a level in the ToC has chunked child elements, they will be included in this element within the <td:tocentry>, after the <td:toclink>.
Styling
Once a document has been decorated with @td:role and other attributes, it
becomes possible via XSLT to apply default styling to decorated elements. Titania
Delivery
provides such an XSLT module, which can be referenced from any other XSLT at the URN
urn:titania:xsl:modules:decorated-html.xsl
.
In addition, the document type can specify a /HARP-META/html.xsl
file
containing universal HTML styling rules for its elements. If present, this file will
automatically be included via the decorated-html.xsl
module. This is
most necessary for non-HTML table models, which will not be handled by the
decorated-html.xsl
transform by default, but may include much more.
The built-in DocBook 5 document type, for example, includes the entire DocBook XSLT
suite
via an inclusion from html.xsl
.
All that should be needed for most styling purposes is to include the
decorated-html.xsl
module. For example, the preview stylesheet for
most non-DITA doctypes can, in their entirety, look like this:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:include href="urn:titania:xsl:modules:decorated-html.xsl"/> </xsl:stylesheet>
This will automatically apply the styling in html.xsl
, as well as the
default styling for elements decorated with @td:role.