summaryrefslogtreecommitdiffstats
path: root/doc/tools/spec-strip-docs
blob: 52d84bce41a738ff88733a1883e26a6a39e271ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh

DIST_BIN=`dirname "$0"`

CMD=xsltproc
XSL=${DIST_BIN}/spec-strip-docs.xsl

if test "x$1" = "x" -o  "x$1" = "x-h" -o "x$1" = "x--help"; then
    echo "usage: $0 [file] ..."
    exit 1
fi

if [ ! -r ${XSL} ]; then
    echo "Cannot find XSLT file"
    exit 1
fi

FILES="$@"
for FILE in $FILES; do
    echo "${FILE}" | grep ".xml$" > /dev/null
    if [ $? -ne 0 ]; then
        echo "Skipping non-xml file: ${FILE}"
        continue
    fi

    d=`dirname ${FILE}`
    b=`basename ${FILE} .xml`

    outfile="${b}-no-docs.xml"
    echo "Creating: ${outfile}"
    ${CMD} ${XSL} ${FILE} | tail -n +2  > ${outfile}
done

exit 0