diff options
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> |