diff --git a/src/apply.xsl b/src/apply.xsl
index fc184c6..b7c4940 100644
--- a/src/apply.xsl
+++ b/src/apply.xsl
@@ -162,78 +162,4 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/apply/partial.xsl b/src/apply/partial.xsl
index 2208a95..e078163 100644
--- a/src/apply/partial.xsl
+++ b/src/apply/partial.xsl
@@ -29,7 +29,7 @@
xmlns:f="http://www.lovullo.com/hoxsl/apply"
xmlns:_f="http://www.lovullo.com/hoxsl/apply/_priv">
-
+
-
+
+
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
+ select="$fnref">
+
+
-
-
+
-
-
-
-
-
-
+
@@ -125,8 +104,7 @@
+ and exists( $fnref[ 2 ] )" />
@@ -146,24 +124,18 @@
match="f:ref"
priority="1">
-
-
+
-
-
@@ -180,14 +152,16 @@
are supported}. This should be enough.
-->
-
-
+
-
+
+
-
+
diff --git a/src/apply/ref.xsl b/src/apply/ref.xsl
new file mode 100644
index 0000000..c1a7be4
--- /dev/null
+++ b/src/apply/ref.xsl
@@ -0,0 +1,237 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/transform/apply-gen.xsl b/src/transform/apply-gen.xsl
index 1591d50..adf5401 100644
--- a/src/transform/apply-gen.xsl
+++ b/src/transform/apply-gen.xsl
@@ -36,6 +36,8 @@
xmlns:out="http://www.lovullo.com/hoxsl/apply/gen/_out"
exclude-result-prefixes="#default fgen">
+
+
@@ -119,11 +121,10 @@
dependencies and simply specify the full namespace URI -->
-
+ select="namespace-uri-from-QName( $name-resolv )" />
+
@@ -164,15 +165,10 @@
-
-
+
-
-
-
-
+
diff --git a/test/apply.xspec b/test/apply.xspec
index 7f6ad61..cbaff69 100644
--- a/test/apply.xspec
+++ b/test/apply.xspec
@@ -418,162 +418,4 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test/apply/arity.xspec b/test/apply/arity.xspec
deleted file mode 100644
index bb94b01..0000000
--- a/test/apply/arity.xspec
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test/apply/partial-test.xsl b/test/apply/partial-test.xsl
index 99dfadd..bdb0422 100644
--- a/test/apply/partial-test.xsl
+++ b/test/apply/partial-test.xsl
@@ -41,8 +41,10 @@
-
-
+
+
+
diff --git a/test/apply/partial.xspec b/test/apply/partial.xspec
index eda5a53..aca7643 100644
--- a/test/apply/partial.xspec
+++ b/test/apply/partial.xspec
@@ -51,11 +51,8 @@
-
-
-
+
@@ -68,15 +65,14 @@
-
-
-
+
+
+ test="$rargs[ 1 ] is $args/foo:a
+ and $rargs[ 2 ] is $args/foo:b" />
@@ -93,10 +89,11 @@
test="$x:result[ 1 ]
and $x:result[ 1 ] = foo:ternary-applied" />
+
+ test="$rargs[ 1 ] is $args/foo:a
+ and $rargs[ 2 ] is $args/foo:b
+ and $rargs[ 3 ] is $args/foo:c" />
@@ -108,16 +105,17 @@
-
+
+ test="count( f:args( $x:result ) ) = 2" />
+
+ test="$rargs[ 1 ] is $args/foo:a
+ and $rargs[ 2 ] is $args/foo:b" />
@@ -192,9 +190,9 @@
test="$x:result[ 1 ] = foo:applied[ @n = 3 ]" />
+ test="$x:result[ 2 ] = $args/foo:a
+ and $x:result[ 3 ] = $args/foo:b
+ and $x:result[ 4 ] = $args/foo:c" />
@@ -406,7 +404,9 @@
+ assert on that; we are going to explicitly choose to *not*
+ support that behavior, since an fnref acquires meaning as an
+ opaque unit -->
@@ -414,8 +414,8 @@
select="f:partial( foo:ternary(), (1, 2) )[ 1 ]" />
-
+
@@ -439,8 +439,7 @@
-
-
+ and $x:result[ 3 ] is $args/foo:c
+ and $x:result[ 4 ] is $args/foo:d" />
diff --git a/src/apply/arity.xsl b/test/apply/ref-test.xsl
similarity index 53%
rename from src/apply/arity.xsl
rename to test/apply/ref-test.xsl
index 5e9de23..268b805 100644
--- a/src/apply/arity.xsl
+++ b/test/apply/ref-test.xsl
@@ -1,6 +1,6 @@
+ xmlns="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:f="http://www.lovullo.com/hoxsl/apply"
+ xmlns:foo="http://www.lovullo.com/_junk">
+
+
-
-
-
-
-
-
-
-
+
+
diff --git a/test/apply/ref.xspec b/test/apply/ref.xspec
new file mode 100644
index 0000000..86d0b2a
--- /dev/null
+++ b/test/apply/ref.xspec
@@ -0,0 +1,550 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/transform/apply-gen.xspec b/test/transform/apply-gen.xspec
index 51de570..151731c 100644
--- a/test/transform/apply-gen.xspec
+++ b/test/transform/apply-gen.xspec
@@ -184,13 +184,39 @@
-
-
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+