开发者

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());
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜