| Newsgroups |
gmane.text.xml.xsl.general.mulberrytech |
| Message-ID |
<[email protected]> |
<html>
<head>
<meta name=3D"viewport" content=3D"width=3Ddevice-width">
<meta http-equiv=3D"Content-Type" content=3D"text/vnd.ui.insecure+html;ch=
arset=3Dutf-8">
</head>
<body style=3D"overflow-wrap:break-word; word-break: break-word;"><div cla=
ss=3D"mail_android_message" style=3D"line-height: 1; padding: 0.5em">Use $l=
ocal:function<br/><br/>--<br/>Diese Nachricht wurde von meinem Android Mobi=
ltelefon mit GMX Mail gesendet.</div><div class=3D"mail_android_quote" styl=
e=3D"line-height: 1; padding: 0.3em"><html><body>Am 14.05.21, 14:15 schrieb=
"Graydon [email protected]" <[email protected]=
ech.com>:</body></html><blockquote class=3D"gmail_quote" style=3D"margin=
: 0.8ex 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-l=
eft: 1ex;">
On Thu, May 13, 2021 at 09:20:49PM -0000, Michael Kay [email protected] s=
cripsit:
<br> > To pass the function itself, rather than the result of a functi=
on call, use local:getString#2.
<br>=20
<br> Thank you!
<br>=20
<br> That moves the error into the stylesheet called by transform():
<br>=20
<br> Engine name: Saxon-EE 10.3 (External)
<br> Severity: error
<br> Description: Cannot find a 1-argument function named Q{data:,dpc}tin=
y()
<br>=20
<br> The tiny test example has an "outer" stylesheet:
<br>=20
<br> <?xml version=3D"1.0" encoding=3D"UTF-8"?>
<br> <xsl:stylesheet xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform"
<br> xmlns:xs=3D"http://www.w3.org/2001/XMLSchema"
<br> xmlns:math=3D"http://www.w3.org/2005/xpath-functions/math"
<br> xmlns:xd=3D"http://www.oxygenxml.com/ns/doc/xsl"
<br> xmlns:local=3D"data:,dpc"
<br> exclude-result-prefixes=3D"xs math xd local"
<br> version=3D"3.0">
<br> <xd:doc scope=3D"stylesheet">
<br> <xd:desc>
<br> <xd:p><xd:b>Created on:</xd:b> May 13, 2021</xd=
:p>
<br> <xd:p><xd:b>Author:</xd:b> graydon</xd:p>
<br> <xd:p>pass a function to a transform() call</xd:p>
<br> </xd:desc>
<br> </xd:doc>
<br> <xd:doc>
<br> <xd:desc>minimalist function</xd:desc>
<br> <xd:param name=3D"in">whatever string we're called with</xd=
:param>
<br> </xd:doc>
<br> <xsl:function name=3D"local:tiny" as=3D"text()">
<br> <xsl:param name=3D"in" as=3D"xs:string" />
<br> <xsl:value-of select=3D"$in" />
<br> </xsl:function>
<br>=20
<br> <!-- test content -->
<br> <xsl:variable name=3D"consume" as=3D"document-node()">
<br> <xsl:document>
<br> <stuff>
<br> <goes>
<br> <here>Around the words</here>
<br> </goes>
<br> </stuff>
<br> </xsl:document>
<br> </xsl:variable>
<br>=20
<br> <xd:doc>
<br> <xd:desc>do the thing</xd:desc>
<br> </xd:doc>
<br> <xsl:template name=3D"xsl:initial-template">
<br> <xsl:variable name=3D"testResult">
<br> <xsl:sequence select=3D"
<br> transform(map {
<br> 'stylesheet-location': 'functionTest.xsl',
<br> 'source-node': $consume,
<br> 'stylesheet-params': map {
<br> QName('local', 'tiny'): local:tiny#1
<br> }
<br> })?output" />
<br> </xsl:variable>
<br> <xsl:sequence select=3D"$testResult" />
<br> </xsl:template>
<br> </xsl:stylesheet>
<br>=20
<br> calling
<br>=20
<br> <?xml version=3D"1.0" encoding=3D"UTF-8"?>
<br> <xsl:stylesheet xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform"
<br> xmlns:xs=3D"http://www.w3.org/2001/XMLSchema"
<br> xmlns:math=3D"http://www.w3.org/2005/xpath-functions/math"
<br> xmlns:xd=3D"http://www.oxygenxml.com/ns/doc/xsl"
<br> xmlns:local=3D"data:,dpc"
<br> exclude-result-prefixes=3D"xs math xd local"
<br> version=3D"3.0">
<br> <xd:doc scope=3D"stylesheet">
<br> <xd:desc>
<br> <xd:p><xd:b>Created on:</xd:b> May 13, 2021</xd=
:p>
<br> <xd:p><xd:b>Author:</xd:b> graydon</xd:p>
<br> <xd:p></xd:p>
<br> </xd:desc>
<br> </xd:doc>
<br> <xsl:param name=3D"local:tiny" as=3D"function(xs:string) as text(=
)" />
<br>=20
<br> <xsl:mode on-no-match=3D"shallow-copy"/>
<br>=20
<br> <xd:doc>
<br> <xd:desc>this is the test case</xd:desc>
<br> </xd:doc>
<br> <xsl:template match=3D"goes">
<br> <xsl:copy>
<br> <xsl:sequence select=3D"local:tiny('away')" />
<br> </xsl:copy>
<br> </xsl:template>
<br> </xsl:stylesheet>
<br>=20
<br> presumably I have not set the parameter up correctly to be recognize=
d as
<br> a function in the stylesheet being called by transform(), but I'm
<br> finding myself at a loss as to how not.
<br>=20
<br> What am I doing wrong, here?
<br>=20
<br> Thanks!
<br>=20
<br> --=20
<br> Graydon Saunders | [email protected]
<br> =C3=9E=C3=A6s ofer=C3=A9ode, =C3=B0isses sw=C3=A1 m=C3=A6g.
<br> -- Deor ("That passed, so may this.")
<br>=20
<br>=20
<br>=20
</blockquote></div></body>
</html>
<div><!-- begin bl.html.trailer -->
<div style=3D"border-top:1px solid black; background-color: #dddddd;
color: #888888; font-size: smaller; padding: 5px; text-align: center;
font-family: arial,verdana,arial,sans-serif; margin-top:1em; clear:
both; margin: auto">
<a href=3D"http://www.mulberrytech.com/xsl/xsl-list">
XSL-List info and archive</a>
<div style=3D"text-align:center;">
<a style=3D"color: blue;"
href=3D"http://lists.mulberrytech.com/unsub/xsl-list/3329386"
>EasyUnsubscribe</a>
(<a style=3D"color: blue;"
href=3D"mailto:[email protected]?subject=3Dremove"
>by email</a>)
</div>
</div>
<!-- end bl.html.trailer --></div>