Author: jtr
Update of /cvs/docs/docs-common/packaging
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv26796
Modified Files:
doctype.xsl
Added Files:
doctype
Log Message:
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.
--- NEW FILE doctype ---
#!/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"}'
Index: doctype.xsl
===================================================================
RCS file: /cvs/docs/docs-common/packaging/doctype.xsl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- doctype.xsl 25 Dec 2005 19:26:10 -0000 1.1
+++ doctype.xsl 12 Jan 2006 02:11:30 -0000 1.2
@@ -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>