tags:

views:

85

answers:

0

I'm having some trouble with XSL-processing when there are stylesheets that include other stylesheets relatively.

(the XML-files may be irrelevant but are included for completeness - code is at the bottom).

Given the XML-file:

<?xml version="1.0" ?>
<famous-persons>
<persons category="medicine">
  <person>
   <firstname> Edward   </firstname>
   <name>      Jenner   </name>
  </person>
</persons>
</famous-persons>

and the XSL-file:

<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
  <xsl:include href="included.xsl" />
</xsl:stylesheet>

referencing this stylesheet in the same directory called included.xsl:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0"> 
  <xsl:template match="/">
     <html><head><title>Sorting example</title></head><body>
    </body></html>
  </xsl:template>
</xsl:stylesheet>

how can I make it that the following code fragment:

NSError *lError = nil;
NSXMLDocument *lDocument = [ [ NSXMLDocument alloc ] initWithContentsOfURL:
                                        [ NSURL URLWithString: @"file:///pathto/data.xml" ]
                                    options: 0
                                    error: &lError ];

NSXMLDocument *lResult = [ lDocument objectByApplyingXSLTAtURL: [ NSURL URLWithString: @"file:///pathto/style.xsl" ]
                                    arguments: nil
                                    error: nil ];

does not give me the error:

I/O warning : failed to load external entity "included.xsl"
compilation error: element include
xsl:include : unable to load included.xsl

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.

Is there any way to make the XSL processing so that a stylesheet can include another stylesheet in its local path?