title: xsl:for-each file in directory(common solution)
body: <p>I found solution for subj related to the Visual Studio XSLT processor:</p>
  
  <pre><code>   public class XsltListFilesExtension
      {
          public XPathNodeIterator ListFiles(string directoryPath)
          {
              XmlDocument doc = new XmlDocument();
              doc.AppendChild(doc.CreateElement("files"));
  
              DirectoryInfo di = new DirectoryInfo(directoryPath);
              foreach (FileInfo fi in di.GetFiles())
              {
                  XmlElement file = doc.CreateElement("file");
                  file.SetAttribute("name", fi.Name);
                  file.SetAttribute("size", fi.Length.ToString());
                  doc.DocumentElement.AppendChild(file);
              }
              return doc.DocumentElement.CreateNavigator().SelectChildren("file", "");
          }
      }
  
      class Program
      {
          static void Main(string[] args)
          {
              XslTransform t = new XslTransform();
              t.Load("transform.xslt");
  
              XsltArgumentList xsltArgs = new XsltArgumentList();
              xsltArgs.AddExtensionObject("urn:list-files-extension", new XsltListFilesExtension());
  
              XPathDocument input = new XPathDocument("input.xml");
              using (FileStream output = new FileStream("output.txt", FileMode.Create))
              {
                  t.Transform(input, xsltArgs, output);
              }
          }
      }
  </code></pre>
  
  <p>The XSLT trasform.xslt:</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"
      xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
      xmlns:lfe="urn:list-files-extension"&gt;
      &lt;xsl:output method="text" indent="yes"/&gt;
  
      &lt;xsl:template match="/"&gt;
          &lt;xsl:for-each select="lfe:ListFiles('D:\temp')"&gt;
              &lt;xsl:value-of select="@name"/&gt;
              &lt;xsl:text&gt; - &lt;/xsl:text&gt;
              &lt;xsl:value-of select="@size"/&gt;
              &lt;xsl:text&gt;bytes
  &lt;/xsl:text&gt;
          &lt;/xsl:for-each&gt;
      &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>Can I to do solution like this but for common scope, for instance: the same xslt file can execute using java xslt processor, C# and etc. ? 
  Thanks.</p>