Got this error "Cannot find a matching 1-argument function named {urn:rend-scripts}GetImageString().” when invoking C# Method GetImageString(String) from XSLT using Saxon9ee Processor. please help me how to resolve this.
Code:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xpp="http://www.sdl.com/xpp" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:rend="urn:rend-scripts" exclude-result-prefixes="xsl xpp msxsl rend">
<msxsl:script language="c#" implements-prefix="rend">
<msxsl:assembly href="C:\Users\velagasx\Desktop\dll4rtf\System.IO.dll"/>
<msxsl:assembly href="C:\Users\velagasx\Desktop\dll4rtf\System.Drawing.dll"/>
<msxsl:using namespace="System.IO"/>
<msxsl:using namespace="System.Drawing"/>
<![CDATA[
public string GetImageString(String path_to_image){
MemoryStream stream = new MemoryStream();
Image img = Image.FromFile(path_to_image);
img.Save(stream, System.Drawing.Imaging.ImageFormat.Tiff);
byte[] bytes = stream.ToArray();
string output = BitConverter.ToString(bytes, 0).Replace("-", string.Empty);
return output;
}
]]>
<xsl:template match="img">
<xsl:value-of select="rend:GetImageString(@path)"/>
</xsl:template>
thanks
Srinadh
"rend:GetImageString('somethingFixed')"? It could be you need to either a: convert the@pathto a string before passing it in (maybe thetext()function?), or b: have the method accept anXPathNodeIterator