diff options
author | Tommy Reynolds <Tommy.Reynolds@MegaCoder.com> | 2006-01-12 02:11:30 +0000 |
---|---|---|
committer | Tommy Reynolds <Tommy.Reynolds@MegaCoder.com> | 2006-01-12 02:11:30 +0000 |
commit | a5e295c31ddfbf7b66f988f6d0f1654a26d0354e (patch) | |
tree | c40a3c0b96b3d0f80ba2ffd1e14ac5cb34167fda /packaging | |
parent | caf3aa419452255e69c628f83df7bda5c9ed5c07 (diff) | |
download | fedora-doc-utils-a5e295c31ddfbf7b66f988f6d0f1654a26d0354e.tar.gz fedora-doc-utils-a5e295c31ddfbf7b66f988f6d0f1654a26d0354e.tar.xz fedora-doc-utils-a5e295c31ddfbf7b66f988f6d0f1654a26d0354e.zip |
Solving the chicken-and-egg problem of creating the
"fdp-info-${LANG}.xml" file by using a simple shell script to pick
out the document type. This is needed because, without the
"fdp-info-${LANG}.xml" file, a new document will not validate and the
xsltproc script "doctype.xsl" cannot determine the document type. To
avoid nasty in-place sed(1)'ing to circumvent the problem, I'll opt
for a non-XML solution.
Diffstat (limited to 'packaging')
-rwxr-xr-x | packaging/doctype | 14 | ||||
-rw-r--r-- | packaging/doctype.xsl | 12 |
2 files changed, 26 insertions, 0 deletions
diff --git a/packaging/doctype b/packaging/doctype new file mode 100755 index 0000000..a10441f --- /dev/null +++ b/packaging/doctype @@ -0,0 +1,14 @@ +#!/bin/sh +######################################################################## +# Script to print the document type, without needing the XML document +# to validate. Get the document type from the first argument to the +# <!DOCTYPE> element, which should be either "book" or "article". +# +# Use it like this: +# doctype file.xml +# +# If you know the XML file WILL VALIDATE, you may use the "doctype.xsl" +# script instead. If not, use this one +######################################################################## +egrep '^[[:space:]]*<!DOCTYPE' $* | +awk '{print $2 "info"}' diff --git a/packaging/doctype.xsl b/packaging/doctype.xsl index 8cf535e..eb6e41a 100644 --- a/packaging/doctype.xsl +++ b/packaging/doctype.xsl @@ -1,5 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + This stylesheet will output the word "articleinfo" or + "bookinfo" by finding either the <article> or <book> XML + element in the document. Use it like this: + + xsltproc doctype.xsl file.xml + + The "file.xml" file MUST VALIDATE in order for the results + to be meaningful. If the document might not validate, use the + "doctype" shell script instead. + --> + <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output omit-xml-declaration="yes"/> <xsl:template match="/article">articleinfo</xsl:template> |