2014-11-21 09:15:24 -05:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<!--
|
|
|
|
Tests dynamic function application
|
|
|
|
|
|
|
|
Copyright (C) 2014 LoVullo Associates, Inc.
|
|
|
|
|
|
|
|
This file is part of hoxsl.
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
-->
|
|
|
|
|
|
|
|
<stylesheet version="2.0"
|
|
|
|
xmlns="http://www.w3.org/1999/XSL/Transform"
|
2016-03-26 14:17:30 -04:00
|
|
|
xmlns:f="http://mikegerwitz.com/hoxsl/apply"
|
|
|
|
xmlns:foo="http://mikegerwitz.com/_junk">
|
2014-11-21 09:15:24 -05:00
|
|
|
|
|
|
|
<import href="../src/apply.xsl" />
|
|
|
|
|
|
|
|
|
2014-11-26 15:35:35 -05:00
|
|
|
<!-- catch errors (otherwise, we'd terminate) -->
|
|
|
|
<template mode="f:apply"
|
|
|
|
match="*"
|
|
|
|
priority="2">
|
|
|
|
<foo:unknown-dyn-fun />
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<template mode="f:apply"
|
|
|
|
match="f:ref[ foo:fn0 ]"
|
|
|
|
priority="5">
|
2014-11-21 09:15:24 -05:00
|
|
|
<!-- return something to show that we were called properly -->
|
2014-11-26 11:16:24 -05:00
|
|
|
<foo:applied n="0" />
|
2014-11-21 09:15:24 -05:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
2014-11-26 15:35:35 -05:00
|
|
|
<template mode="f:apply"
|
|
|
|
match="f:ref[ foo:fn1 ]"
|
|
|
|
priority="5">
|
2014-11-21 09:15:24 -05:00
|
|
|
<param name="arg1" />
|
|
|
|
|
2014-11-26 11:16:24 -05:00
|
|
|
<foo:applied n="1" />
|
|
|
|
<sequence select="$arg1" />
|
2014-11-21 09:15:24 -05:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
2014-11-26 15:35:35 -05:00
|
|
|
<template mode="f:apply"
|
|
|
|
match="f:ref[ foo:fn2 ]"
|
|
|
|
priority="5">
|
2014-11-21 09:15:24 -05:00
|
|
|
<param name="arg1" />
|
|
|
|
<param name="arg2" />
|
|
|
|
|
2014-11-26 11:16:24 -05:00
|
|
|
<foo:applied n="2" />
|
|
|
|
<sequence select="$arg1, $arg2" />
|
2014-11-21 09:15:24 -05:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
2014-11-26 15:35:35 -05:00
|
|
|
<template mode="f:apply"
|
|
|
|
match="f:ref[ foo:fn3 ]"
|
|
|
|
priority="5">
|
2014-11-21 09:15:24 -05:00
|
|
|
<param name="arg1" />
|
|
|
|
<param name="arg2" />
|
|
|
|
<param name="arg3" />
|
|
|
|
|
2014-11-26 11:16:24 -05:00
|
|
|
<foo:applied n="3" />
|
|
|
|
<sequence select="$arg1, $arg2, $arg3" />
|
2014-11-21 09:15:24 -05:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
2014-11-26 15:35:35 -05:00
|
|
|
<template mode="f:apply"
|
|
|
|
match="f:ref[ foo:fn4 ]"
|
|
|
|
priority="5">
|
2014-11-21 09:15:24 -05:00
|
|
|
<param name="arg1" />
|
|
|
|
<param name="arg2" />
|
|
|
|
<param name="arg3" />
|
|
|
|
<param name="arg4" />
|
|
|
|
|
2014-11-26 11:16:24 -05:00
|
|
|
<foo:applied n="4" />
|
|
|
|
<sequence select="$arg1, $arg2, $arg3, $arg4" />
|
2014-11-21 09:15:24 -05:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
2014-11-26 15:35:35 -05:00
|
|
|
<template mode="f:apply"
|
|
|
|
match="f:ref[ foo:fn5 ]"
|
|
|
|
priority="5">
|
2014-11-21 09:15:24 -05:00
|
|
|
<param name="arg1" />
|
|
|
|
<param name="arg2" />
|
|
|
|
<param name="arg3" />
|
|
|
|
<param name="arg4" />
|
|
|
|
<param name="arg5" />
|
|
|
|
|
2014-11-26 11:16:24 -05:00
|
|
|
<foo:applied n="5" />
|
|
|
|
<sequence select="$arg1, $arg2, $arg3, $arg4,
|
|
|
|
$arg5" />
|
2014-11-21 09:15:24 -05:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
2014-11-26 15:35:35 -05:00
|
|
|
<template mode="f:apply"
|
|
|
|
match="f:ref[ foo:fn6 ]"
|
|
|
|
priority="5">
|
2014-11-21 09:15:24 -05:00
|
|
|
<param name="arg1" />
|
|
|
|
<param name="arg2" />
|
|
|
|
<param name="arg3" />
|
|
|
|
<param name="arg4" />
|
|
|
|
<param name="arg5" />
|
|
|
|
<param name="arg6" />
|
|
|
|
|
2014-11-26 11:16:24 -05:00
|
|
|
<foo:applied n="6" />
|
|
|
|
<sequence select="$arg1, $arg2, $arg3, $arg4,
|
|
|
|
$arg5, $arg6" />
|
2014-11-21 09:15:24 -05:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
2014-11-26 15:35:35 -05:00
|
|
|
<template mode="f:apply"
|
|
|
|
match="f:ref[ foo:fn7 ]"
|
|
|
|
priority="5">
|
2014-11-21 09:15:24 -05:00
|
|
|
<param name="arg1" />
|
|
|
|
<param name="arg2" />
|
|
|
|
<param name="arg3" />
|
|
|
|
<param name="arg4" />
|
|
|
|
<param name="arg5" />
|
|
|
|
<param name="arg6" />
|
|
|
|
<param name="arg7" />
|
|
|
|
|
2014-11-26 11:16:24 -05:00
|
|
|
<foo:applied n="7" />
|
|
|
|
<sequence select="$arg1, $arg2, $arg3, $arg4,
|
|
|
|
$arg5, $arg6, $arg7" />
|
2014-11-21 09:15:24 -05:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
2014-11-26 15:35:35 -05:00
|
|
|
<template mode="f:apply"
|
|
|
|
match="f:ref[ foo:fn8 ]"
|
|
|
|
priority="5">
|
2014-11-21 09:15:24 -05:00
|
|
|
<param name="arg1" />
|
|
|
|
<param name="arg2" />
|
|
|
|
<param name="arg3" />
|
|
|
|
<param name="arg4" />
|
|
|
|
<param name="arg5" />
|
|
|
|
<param name="arg6" />
|
|
|
|
<param name="arg7" />
|
|
|
|
<param name="arg8" />
|
|
|
|
|
2014-11-26 11:16:24 -05:00
|
|
|
<foo:applied n="8" />
|
|
|
|
<sequence select="$arg1, $arg2, $arg3, $arg4,
|
|
|
|
$arg5, $arg6, $arg7, $arg8" />
|
2014-11-21 09:15:24 -05:00
|
|
|
</template>
|
2014-11-26 16:46:02 -05:00
|
|
|
|
|
|
|
|
|
|
|
<function name="foo:arg8-check">
|
|
|
|
<param name="args" as="item()+" />
|
|
|
|
<param name="result" as="item()+" />
|
|
|
|
|
|
|
|
<sequence select="$result[ 1 ] instance of element( foo:applied )
|
|
|
|
and $result[ 2 ] is $args[1]
|
|
|
|
and $result[ 3 ] is $args[2]
|
|
|
|
and $result[ 4 ] is $args[3]
|
|
|
|
and $result[ 5 ] is $args[4]
|
|
|
|
and $result[ 6 ] is $args[5]
|
|
|
|
and $result[ 7 ] is $args[6]
|
|
|
|
and $result[ 8 ] is $args[7]
|
|
|
|
and $result[ 9 ] is $args[8]" />
|
|
|
|
</function>
|
2014-11-21 09:15:24 -05:00
|
|
|
</stylesheet>
|