Common snippets

Paul W. Frields stickster at
Fri Apr 6 17:41:36 UTC 2007

So today's realization of using xml:base triggered thoughts of a proper
strategy for dealing with snippets.  "Snippets" are what we've usually
called the small pieces of XML that would be common across many
documents, such as:

 * instructions for using CVS
 * legal notice in a variety of element structures
 * special notices such as how to report bugs

A snippet might look like this:

      <title>Reporting Bugs</title>
      <para>Use Bugzilla and be forever in our hearts!</para>

I am working on changing all common snippets into gettext form -- that
is, using one basic XML (the en_US canonical version) and POT/PO to
translate it.  This is the same way we treat all other documents and the
common entities.

The location of a snippet is a URI that appears in a @href attribute in
an <xi:include/> element.  That means it can't be translated.  But the
@href must point to the proper locale version of a file, say,
"legalnotice-en_US.xml" versus "legalnotice-pt_BR.xml".  How do we
ensure the @href points to the right place, in a sane, XML-compliant

1.  Use a new ${XMLSNIPPETS} variable in the document-specific Makefile,
which is defined as one or more names of XML snippet files, separated by
proper whitespace:

XMLSNIPPETS =   cvs.xml                         \
                bug-reporting.xml               \

2.  ${XMLSNIPPETS} file contents are not included in the POT for the
specific document -- rather, they are translated in their common
location, which only needs to be done once, and again whenever those
actual snippets change content.

3.  ${XMLSNIPPETS} files are included in the ${XMLDEPFILES} list of
dependencies for the validation of the entire XML document.

4.  ${XMLSNIPPETS} related targets are added to the Makefile.common to
treat these files in a special way -- changing context to the
${FDPCOMMONDIR}/common folder and making any required targets for the
indicated locale, then copying those target files (if updated) back to
the document-specific locale folder.  (In other words, these targets are
created in much the same way as project-wide common entities files.)

5.  A document author who wants to use a snippet inserts the appropriate
XInclude in the document, and updates ${XMLSNIPPETS} in the
document-specific Makefile.  For an example file "snippet.xml", the
XInclude looks like this and works throughout all locales:

    <xi:include xmlns:xi=""
      href="snippet.xml" />

Paul W. Frields, RHCE                
  gpg fingerprint: 3DA6 A0AC 6D58 FEC4 0233  5906 ACDB C937 BD11 3717
      Fedora Project: stickster @ #fedora-docs, #fedora-devel, #fredlug
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the fedora-docs-list mailing list