| Newsgroups |
gmane.text.xml.xsl.general.mulberrytech |
| Message-ID |
<[email protected]> |
> On 13 May 2021, at 22:05, Graydon [email protected] <xsl-list-service@lis=
ts.mulberrytech.com> wrote:
>=20
> Hello --
>=20
> Using Saxon 10.3 and XSLT 3.0 (from inside oXygen 23), can I pass a funct=
ion as
> a parameter to transform()?
>=20
> <xsl:sequence select=3D"
> transform(map {
> 'stylesheet-location': 'tidy.xsl',
> 'source-node': $tableMerge,
> 'stylesheet-params': map {
> QName('', 'defaultLang'): $defaultLang,
> QName('', 'overrideStringMap'): $overrideStringMap,
> QName('', 'lang2key2autotextMap'): $lang2key2autotextMap,
> QName('local','getString') : local:getString(xs:string,xs:string)
> }
> })?output" />
>=20
> is syntactically acceptable.
yes, but you aren't passing a function, you are passing the result of calli=
ng local:getString with parameters child::xs:string and child::xs:string. U=
nless you have any child elements called xs:string, which is unlikely, the =
actual parameter values are empty sequences, which is probably why the func=
tion is complaining.
To pass the function itself, rather than the result of a function call, use=
local:getString#2.
Michael Kay
Saxonica
>=20
> Inside tidy.xsl,
>=20
> <xsl:param as=3D"xs:string" name=3D"defaultLang" />
> <xsl:param as=3D"map(*)" name=3D"overrideStringMap" />
> <xsl:param as=3D"map(*)" name=3D"lang2key2autotextMap" />
> <xsl:param as=3D"function(xs:string,xs:string) as xs:string" name=3D"loc=
al:getString" />
>=20
> is syntactically acceptable (though oXygen complains about the actual fun=
ction calls and not being able to find the function).
>=20
> If I run the transform, though, I get:
> Engine name: Saxon-EE 10.3 (External)
> Severity: error
> Description: An empty sequence is not allowed as the first argument of lo=
cal:getString()
>=20
> with a location that tells me the transform call parameter map is where t=
he error happens.
>=20
> Is there a way to do this? I can of course duplicate the function defini=
tion but that seems improper.
>=20
> Thanks!
>=20
>=20
> --=20
> Graydon Saunders | [email protected]
> =C3=9E=C3=A6s ofer=C3=A9ode, =C3=B0isses sw=C3=A1 m=C3=A6g.
> -- Deor ("That passed, so may this.")
>=20
>=20
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/3329386
or by email: [email protected]
--~--