User:SwifT/proj2wiki

Project 2 wiki conversion
I am working on a script and XSL translation to convert Gentoo's ProjectXML into MediaWiki style.

Although capturing the details is not possible, we should be able to make this process as painless as manageable.

Process
The script does a two-trap conversion:
 * 1) it translates the ProjectXML to GuideXML (similar to how Gentoo's Gorg system does). This should have no loss of information (as we use the same stylesheets).
 * 2) it translates the GuideXML into MediaWiki format

The last translation does lead to a few problems and need additional work for the moment:
 * 1) nested ul tags (listings) do not properly nest in the output (actually, no nesting at all)

Script
The following script uses the stylesheets available in our CVS repository.


 * 1) !/bin/sh

if [ -z "${PROJ2WIKI_BASE}" ] then echo "PROJ2WIKI_BASE variable is not set."; echo "Please set it to the base location of the Gentoo documentation, like so:" echo "export PROJ2WIKI_BASE=/home/you/cvs/gentoo/xml/htdocs" exit 1; fi

if [ ! -d "${PROJ2WIKI_BASE}" ] then echo "PROJ2WIKI_BASE (\"${PROJ2WIKI_BASE}\") is no valid directory." exit 2; fi

PROJXML="${1}";

if [ ! -f "${PROJ2WIKI_BASE}/${PROJXML}" ] then echo "There is no \"${PROJ2WIKI_BASE}/${PROJXML}\"." exit 3; fi

if [ -z "${XML_CATALOG_FILES}" ] then echo "XML_CATALOG_FILES is not set; please set it to the conversion-catalog file." exit 4; fi

xsltproc --path "${PROJ2WIKI_BASE}" "${PROJ2WIKI_BASE}/xsl/project.xsl" "${PROJ2WIKI_BASE}/${PROJXML}" | xsltproc "${PROJ2WIKI_BASE}/xsl/guidexml2wiki.xsl" -;
 * 1) xsltproc --path "${PROJ2WIKI_BASE}" "${PROJ2WIKI_BASE}/xsl/project.xsl" "${PROJ2WIKI_BASE}/${PROJXML}";

The XML_CATALOG_FILE that we need to point to should contain the following:

 <!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">   

You will need to change the path to the correct location of the check-out.

Then, wiki-code can be attained as follows:

Test pages
Below are a few outputs of test pages

Gentoo Hardened project page but then wikified