John Doe
2003-11-04 03:01:32 UTC
Hi,
I would like to call some AddExtensionObject-provided object method
from a script located inside a <msxsl:script> tag, like this :
XslTransform trans = new XslTransform();
trans.Load(...);
XsltArgumentList args = new XsltArgumentList();
class Foo
{
public string Bar()
{
return " world !";
}
}
Foo foo = new Foo();
args.AddExtensionObject("urn:foo", foo);
<msxsl:script language="C#" implements-prefix="user">
public string MyFunction()
{
// Would like to call Foo.Bar from here
// but don't know how to do it !
return "Hello " + getThisObject("urn:foo").Bar();
}
</msxsl:script>
<xsl:template ...>
<xsl:value-of select="user:MyFunction()"/>
</xsl:template>
MSXML 4.0 does allow embedded scripts to access external objects since
they are passed via xsl:param's.
Isn't there any way to do it with XslTransform ?
Thank you !
-J
I would like to call some AddExtensionObject-provided object method
from a script located inside a <msxsl:script> tag, like this :
XslTransform trans = new XslTransform();
trans.Load(...);
XsltArgumentList args = new XsltArgumentList();
class Foo
{
public string Bar()
{
return " world !";
}
}
Foo foo = new Foo();
args.AddExtensionObject("urn:foo", foo);
<msxsl:script language="C#" implements-prefix="user">
public string MyFunction()
{
// Would like to call Foo.Bar from here
// but don't know how to do it !
return "Hello " + getThisObject("urn:foo").Bar();
}
</msxsl:script>
<xsl:template ...>
<xsl:value-of select="user:MyFunction()"/>
</xsl:template>
MSXML 4.0 does allow embedded scripts to access external objects since
they are passed via xsl:param's.
Isn't there any way to do it with XslTransform ?
Thank you !
-J