Link to embedded image from my xsl
I have an xslt file that is embedded in my assembly. Also embedded in that assembly is an image.
How can i add a reference to that embedded image in my xsl file?
UPDATED:
I am using VS2008 and i add the image and the xslt as an embedded resource in the project. The output ulti开发者_StackOverflow中文版mately ends up being a pdf document.
What you need is probably a custom XmlUrlResolver implementation
/// <summary>
/// Enables loading of xslt stylesheets from embedded resources.
/// </summary>
public class EmbeddedResourceResolver : XmlUrlResolver
{
public override object GetEntity(
Uri absoluteUri,
string role,
Type ofObjectToReturn)
{
var assembly = Assembly.GetExecutingAssembly();
return assembly.GetManifestResourceStream(absoluteUri.Segments.Last());
}
}
精彩评论