1#!/bin/sh
2#
3# Copyright (c) 2010 Kirei AB. All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8# 1. Redistributions of source code must retain the above copyright
9#    notice, this list of conditions and the following disclaimer.
10# 2. Redistributions in binary form must reproduce the above copyright
11#    notice, this list of conditions and the following disclaimer in the
12#    documentation and/or other materials provided with the distribution.
13#
14# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
18# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
20# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
22# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
24# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25#
26
27XMLLINT=@XMLLINT@
28XSLTPROC=@XSLTPROC@
29
30if [ ! -x "$XMLLINT" ]; then
31	XMLLINT=$(find $(echo "$PATH" | tr : ' ') -maxdepth 1 -name xmllint -print -quit)
32	if [ ! -x "$XMLLINT" ]; then
33		echo "error: xmllint required, but not found"
34		exit 1
35	fi
36fi
37
38if [ ! -x "$XSLTPROC" ]; then
39	XSLTPROC=$(find $(echo "$PATH" | tr : ' ') -maxdepth 1 -name xsltproc -print -quit)
40	if [ ! -x "$XSLTPROC" ]; then
41		echo "error: xsltproc required, but not found"
42		exit 1
43	fi
44fi
45
46KASP_SCHEMA=@OPENDNSSEC_DATA_DIR@/kasp.rng
47KASP_XSL=@OPENDNSSEC_DATA_DIR@/kasp2html.xsl
48
49KASP_XML=$1
50
51if [ -f "$KASP_XML" ]; then
52        $XMLLINT --noout --relaxng $KASP_SCHEMA $KASP_XML && \
53        $XSLTPROC $KASP_XSL $KASP_XML
54else
55	echo "usage: $0 [kasp.xml]"
56fi
57