apply-gen now uses `f:make-ref'

We're essentailly macro-expanding the `f:make-ref' call.  :)
master
Mike Gerwitz 2014-11-30 03:28:00 -05:00
parent 5857eed3d6
commit bc871435fa
2 changed files with 40 additions and 18 deletions

View File

@ -36,6 +36,8 @@
xmlns:out="http://www.lovullo.com/hoxsl/apply/gen/_out"
exclude-result-prefixes="#default fgen">
<import href="../apply/ref.xsl" />
<output indent="yes"
encoding="utf-8" />
@ -119,11 +121,10 @@
dependencies and simply specify the full namespace URI -->
<variable name="name-resolv"
select="resolve-QName( @name, . )" />
<variable name="ns-prefix"
select="substring-before( @name, ':' )" />
<variable name="ns"
select="namespace-uri-for-prefix(
$ns-prefix, . )" />
select="namespace-uri-from-QName( $name-resolv )" />
<variable name="ns-prefix"
select="prefix-from-QName( $name-resolv )" />
<sequence select="fgen:create-func(
., $name-resolv, $ns-prefix, $ns )" />
@ -164,15 +165,10 @@
<namespace name="{$ns-prefix}"
select="$ns" />
<f:ref>
<attribute name="arity"
select="count( $fnref/xsl:param )" />
<variable name="arity"
select="count( $fnref/xsl:param )" />
<!-- represents the function being referenced -->
<element name="{$local-name}"
namespace="{$ns}">
</element>
</f:ref>
<sequence select="f:make-ref( $name-resolv, $arity )" />
</out:function>
</function>

View File

@ -184,13 +184,39 @@
<!-- note that this _does not_ test f:arity itself: it is intended
to test that the arity datum is properly generated -->
<scenario label="f:arity">
<call function="f:arity">
<param name="fnref" select="foo:sub-two()" />
</call>
<scenario label="constructed dynamic function reference">
<variable name="two-result"
select="foo:sub-two()" />
<expect label="is able to determine arity"
test="$x:result = 2" />
<scenario label="is recognized as">
<call function="f:is-ref">
<param name="fnref" select="$two-result" />
</call>
<expect label="a dynamic function reference"
select="true()" />
</scenario>
<scenario label="target QName">
<call function="f:QName">
<param name="fnref" select="$two-result" />
</call>
<expect label="is the QName of the target function"
select="QName( 'http://www.lovullo.com/_junk',
'sub-two' )" />
</scenario>
<scenario label="arity">
<call function="f:arity">
<param name="fnref" select="$two-result" />
</call>
<expect label="is the arity of target function"
select="2" />
</scenario>
</scenario>
</scenario>
</description>