title: Get filepath of XSLT stylesheet in embedded C# code? (MSXML)
body: <p>I use XSLT + C# code like the following:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
                  xmlns:msxsl="urn:schemas-microsoft-com:xslt"
                  xmlns:local="urn:local"
                  extension-element-prefixes="msxsl"
                  exclude-result-prefixes="msxsl local"&gt;
  
    &lt;msxsl:script language="CSharp" implements-prefix="local"&gt;
      &lt;![CDATA[
        public string imageList;
  
        public bool loadImageList()
        {
          imageList = System.IO.File.ReadAllText("C:\\Users\\me\\Project\\images.txt");
          return true;
        }
  
        public bool inImageList(string str)
        {
          return imageList.Contains("\r\n" + str + "\r\n");
        }
      ]]&gt;
    &lt;/msxsl:script&gt;
  
    &lt;xsl:variable name="loadImageList" select="local:loadImageList()"/&gt;
  
    &lt;xsl:template match="/"&gt;
      &lt;xsl:apply-templates select="recordList/record"/&gt;
    &lt;/xsl:template&gt;
  
    &lt;xsl:template match="record"&gt;
      &lt;xsl:if test="inImageList(@id) = true()"&gt;
        &lt;image&gt;
          &lt;xsl:value-of select="concat(@id, '.jpg')"/&gt;
        &lt;/image&gt;
      &lt;/xsl:if&gt;
    &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>In C#, an external file is loaded and the contents are stored in a variable. A function <code>inImageList()</code> provides the means to test, if a certain value is contained in that text. It is called by the XSLT code for conditional code execution (works).</p>
  
  <p>My question: instead of hard-coding the file path <code>C:\\Users\\me\\Project\\images.txt</code>, I would like to provide a path / file name <strong>relative to the .xslt file</strong>. <code>.\\images.txt</code> does not work, it looks in some Visual Studio directory.</p>
  
  <p>Is there a function, system-property or any other way to find out the absolute path to the my .xslt file?</p>