title: Load Xslt with import from assembly in C#
body: <p>I have a xslt file, myxslt.xslt, that contains an import, that looks a bit like this: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;    
  &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
    &lt;xsl:import href="someOtherXsltFile.xslt"/&gt;
    &lt;!--Do some transformations --&gt;  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>I am trying to import these files into my C# application by using the assembly:</p>
  
  <pre><code>Assembly assembly = Assembly.GetExecutingAssembly();
  
          using (Stream xsltStream = assembly.GetManifestResourceStream(mynamespace.myxslt.xslt))
          {
              using (XmlReader xsltReader = XmlReader.Create(xsltStream))
              {
                  xslt.Load(xsltReader);
              }
          }
  </code></pre>
  
  <p>as I saw in this answer: <a href="https://stackoverflow.com/questions/14185087/adding-embedded-resource-schema-to-xmlreadersettings-instead-of-filename#">Adding (Embedded Resource) Schema To XmlReaderSettings Instead Of Filename?</a></p>
  
  <p>The Stream and XmlReader load fine.</p>
  
  <p>However my application throws a cannot find file exception when I try to load the xslt. The file that it cannot load is <code>someOtherXsltFile.xslt</code>. </p>
  
  <p>Both files are loaded as an embedded resource and both are visible in the list from <code>assembly.GetManifestResourceNames</code>.</p>
  
  <p>I would rather not change anything in the xslt files as those are standard files that came with the messages that I am trying to transform.</p>
  
  <p>Is there a way to load my xslt using an import from the assembly?</p>