title: Alternatives for XSLT transformations with Delphi XE8
body: <p>I am trying to perform an XSLT transformation with Delphi XE8 and am running into problems. My XSL file refers to an external XSL file using an import statement whose href attribute has a relative path. The transform fails with the error "Named template 'skrivUtDate' does not appear in the stylesheet." The definition 'skrivUtDate' is located in the external XSL file. The definition looks like the following:</p>
  
  <pre><code>&lt;xsl:template name="skrivUtDate"&gt;
      &lt;xsl:param name="oppgittTid"/&gt;
      &lt;xsl:if test="string-length($oppgittTid)!=0"&gt;
          &lt;xsl:value-of select="substring($oppgittTid,9,2)"/&gt;.&lt;xsl:value-of select="substring($oppgittTid,6,2)"/&gt;.&lt;xsl:value-of select="substring($oppgittTid,3,2)"/&gt;
      &lt;/xsl:if&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>I have placed the external XSL file in the appropriate directory (relative to the original XSL file) but I get the same error (I have also tried all other conceivable directories for this external file, but none have worked). However, I can perform the transformation using EditX XML Editor, so I do not think that the XSL is invalid (Note that this XSL file was provided by a third party, and apparently it is being used successfully by some folks using development platforms other than Delphi).</p>
  
  <p>Here is the opening segment of the XSL file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet version="1.0" 
    xmlns:ref="http://www.kith.no/xmlstds/henvisning/2012-02-15" 
    xmlns:xhtml="http://www.w3.org/1999/xhtml" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:po="http://www.kith.no/xmlstds/po/poKomponent/2009-06-30" 
    xmlns:fk1="http://www.kith.no/xmlstds/felleskomponent1" 
    exclude-result-prefixes="ref xhtml po fk1"&gt;
      &lt;xsl:import href="../../Felleskomponenter/funksjoner.xsl"/&gt;
  </code></pre>
  
  <p>And, yes, the funksjoner.xsl file is in a directory named Felleskomponenter.</p>
  
  <p>My very simple test uses something similar to the following pseudo code:</p>
  
  <pre><code>var
    XML : IXMLDocument;
    XSL : IXMLDocument;
    s: WideString;
  begin
    XML := TXMLDocument.Create(self);
    XML.FileName := 'C:\somepath\some.xml';
    XML.Active := True;
    XSL := TXMLDocument.Create(Self);
    XSL.FileName := 'C:\someotherpath\somefile.xsl';
    XSL.Active := True;
    XML.DocumentElement.TransformNode(XSL.DocumentElement, s);
  </code></pre>
  
  <p>I know that Delphi XE7 started shipping with the Omni XML DOM as well as the ADOM, but those are apparently absent from Delphi XE8. I was hoping that using a different document object model might address the problem.</p>
  
  <p>The XML is pretty complicated, as is the XSL.</p>
  
  <p>Does any body have any suggestions for alternative ways to perform XSLT transformations with Delphi XE8? </p>