Forum Moderators: phranque
On my web site I have XML files with the following declarations:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="kua.xsl"?>
<kua xmlns:xsi="http.//www.w3.org/2000/10/XMLSchema-instance" xsi:noNamespaceSchemaLocation="kua.xsd">
The XSL sheet(kua.xsl) is in the same directory as the xml file.
The problem is the stylesheet is not invoked and the plain XML file is returned. What I want, obviously, is the xml file to be parsed and the generated content(html) to instead be sent to the client.
Why does this not work?
1. Is the XML declaration somehow wrong?
2. What special modules/apache-settings/whatever do I need to make XSL parsing work, if it's not supported by default?
3. If the XSL file have errors, could that be the cause? (it's at least well-formed)
Any suggestions, hints to documentation, is highly appreciated.
Cheers,
Frans
About your questions
1.) It seems to be correct, what you can try is to define a fully qualified url for the href attribute, like [domain.com...]
2.) No, there's no support in Apache (and I think none of the current webservers does it) for server-sided xml translations, but you can make your own engine quite easily - as I explained it above
3.) If the xsl file is not well formed, then the parser would give you an error, but if you made other faults in the code (typo in the element names for example, or wrong element names on the wrong places etc), then it will just won't work, but still, in that case you can see the difference, because if an element does not have a corresponding <template match="element_name"/> in the xsl file, then the built-in templates are used, which simply prints the *content* of the element, for example in the case of the following:
<myelement something="anything">test</myelement>