| 1 |
# CF_IS_XSLT_COMPLIANT(progpath,ACTION-IF-FOUND, ACTION_IF_NOT_FOUND) |
| 2 |
# check for xslt compliance of a given prog, prog must be a full executable |
| 3 |
# execution command, in this command, this substitution will be donne: |
| 4 |
# %1 = xml file |
| 5 |
# %2 = xsl file |
| 6 |
# %3 = html file |
| 7 |
# |
| 8 |
AC_DEFUN([CF_IS_XSLT_COMPLIANT],[ |
| 9 |
cat << \EOF > configtest.xml |
| 10 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
| 11 |
<tool> |
| 12 |
<field id="prodName"> |
| 13 |
<value>HAMMER HG2606</value> |
| 14 |
</field> |
| 15 |
<field id="prodNo"> |
| 16 |
<value>32456240</value> |
| 17 |
</field> |
| 18 |
<field id="price"> |
| 19 |
<value>$30.00</value> |
| 20 |
</field> |
| 21 |
</tool> |
| 22 |
EOF |
| 23 |
cat << \EOF > configtest.xsl |
| 24 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
| 25 |
<xsl:stylesheet version="1.0" |
| 26 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
| 27 |
<xsl:template match="/"> |
| 28 |
<html> |
| 29 |
<body> |
| 30 |
<form method="post" action="edittool.asp"> |
| 31 |
<h2>Tool Information (edit):</h2> |
| 32 |
<table border="0"> |
| 33 |
<xsl:for-each select="tool/field"> |
| 34 |
<tr> |
| 35 |
<td> |
| 36 |
<xsl:value-of select="@id"/> |
| 37 |
</td> |
| 38 |
<td> |
| 39 |
<input type="text"> |
| 40 |
<xsl:attribute name="id"> |
| 41 |
<xsl:value-of select="@id" /> |
| 42 |
</xsl:attribute> |
| 43 |
<xsl:attribute name="name"> |
| 44 |
<xsl:value-of select="@id" /> |
| 45 |
</xsl:attribute> |
| 46 |
<xsl:attribute name="value"> |
| 47 |
<xsl:value-of select="value" /> |
| 48 |
</xsl:attribute> |
| 49 |
</input> |
| 50 |
</td> |
| 51 |
</tr> |
| 52 |
</xsl:for-each> |
| 53 |
</table> |
| 54 |
<br /> |
| 55 |
<input type="submit" id="btn_sub" name="btn_sub" value="Submit" /> |
| 56 |
<input type="reset" id="btn_res" name="btn_res" value="Reset" /> |
| 57 |
</form> |
| 58 |
</body> |
| 59 |
</html> |
| 60 |
</xsl:template> |
| 61 |
</xsl:stylesheet> |
| 62 |
EOF |
| 63 |
AC_MSG_CHECKING([xslt compliance of $1]) |
| 64 |
to_run=$1 |
| 65 |
to_run=${to_run/\%1/configtest.xml} |
| 66 |
to_run=${to_run/\%2/configtest.xsl} |
| 67 |
to_run=${to_run/\%3/configtest.out} |
| 68 |
if AC_TRY_COMMAND([$to_run]);then |
| 69 |
AC_MSG_RESULT([yes]); |
| 70 |
[$2] |
| 71 |
else |
| 72 |
AC_MSG_RESULT([no]); |
| 73 |
[$3] |
| 74 |
fi |
| 75 |
]) |
| 76 |
|
| 77 |
AC_DEFUN([CF_CHECK_XSLT],[ |
| 78 |
AC_ARG_WITH(xsltproc, |
| 79 |
[AS_HELP_STRING([--with-xsltproc=path], [specify xslt engine to use for test report generation])], |
| 80 |
[check_xslt_forcedprogfound=$withval]) |
| 81 |
if test "x$check_xslt_forcedprogfound" != "x"; then |
| 82 |
AC_PATH_PROG([check_xslt_forcedprogfound],[$check_xslt_forcedprogfound],[notfound]) |
| 83 |
fi |
| 84 |
AC_PATH_PROG([check_xslt_xsltprocfound],[xsltproc],[notfound]) |
| 85 |
AC_PATH_PROG([check_xslt_sablotronfound],[sabcmd],[notfound]) |
| 86 |
xslt_prog="notfound" |
| 87 |
if test "$check_xslt_forcedprogfound" != notfound -a "x$check_xslt_forcedprogfound" != x; then |
| 88 |
xslt_prog="$check_xslt_forcedprogfound" |
| 89 |
CF_IS_XSLT_COMPLIANT([$xslt_prog],[$1=$xslt_prog],[xslt_prog="notfound"]) |
| 90 |
fi |
| 91 |
xslt_prog="notfound" |
| 92 |
if test "$check_xslt_xsltprocfound" != notfound -a "$xslt_prog" = notfound; then |
| 93 |
xslt_prog="$check_xslt_xsltprocfound -o %3 %2 %1" |
| 94 |
CF_IS_XSLT_COMPLIANT([$xslt_prog],[$1=$xslt_prog],[xslt_prog="notfound"]) |
| 95 |
fi |
| 96 |
if test "$check_xslt_sablotronfound" != notfound -a "$xslt_prog" = notfound; then |
| 97 |
xslt_prog="$check_xslt_sablotronfound %2 %1 %3" |
| 98 |
CF_IS_XSLT_COMPLIANT([$xslt_prog],[$1=$xslt_prog],[xslt_prog="notfound"]) |
| 99 |
fi |
| 100 |
]) |