Note that there are some explanatory texts on larger screens.

plurals
  1. PONSXMLDocument objectByApplyingXSLT with XSL Include
    text
    copied!<p>I'm having some trouble with XSL-processing when there are stylesheets that include other stylesheets relatively.</p> <p>(the XML-files may be irrelevant but are included for completeness - code is at the bottom).</p> <p>Given the XML-file:</p> <pre><code>&lt;?xml version="1.0" ?&gt; &lt;famous-persons&gt; &lt;persons category="medicine"&gt; &lt;person&gt; &lt;firstname&gt; Edward &lt;/firstname&gt; &lt;name&gt; Jenner &lt;/name&gt; &lt;/person&gt; &lt;/persons&gt; &lt;/famous-persons&gt; </code></pre> <p>and the XSL-file:</p> <pre><code>&lt;?xml version="1.0" ?&gt; &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt; &lt;xsl:include href="included.xsl" /&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>referencing this stylesheet in the same directory called included.xsl:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt; &lt;xsl:template match="/"&gt; &lt;html&gt;&lt;head&gt;&lt;title&gt;Sorting example&lt;/title&gt;&lt;/head&gt;&lt;body&gt; &lt;/body&gt;&lt;/html&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>how can I make it that the following code fragment:</p> <pre><code>NSError *lError = nil; NSXMLDocument *lDocument = [ [ NSXMLDocument alloc ] initWithContentsOfURL: [ NSURL URLWithString: @"file:///pathto/data.xml" ] options: 0 error: &amp;lError ]; NSXMLDocument *lResult = [ lDocument objectByApplyingXSLTAtURL: [ NSURL URLWithString: @"file:///pathto/style.xsl" ] arguments: nil error: nil ]; </code></pre> <p>does not give me the error:</p> <pre><code>I/O warning : failed to load external entity "included.xsl" compilation error: element include xsl:include : unable to load included.xsl </code></pre> <p>I have been trying all sorts of options. Also loading XML documents with NSXMLDocumentXInclude beforehand does not seem to help. Specifying the absolute path to the to-be-included XSL file works flawlessly.</p> <p>Is there any way to make the XSL processing so that a stylesheet can include another stylesheet in its local path?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload