I am trying to style a XML document that uses xinclude to include other xml files for modularity purposes. I'm using Firefox as my tool to visualize the transformation. (All the files are in the same folder) At the moment i have composed the following xsl:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xi="http://www.w3.org/2001/XInclude"
exclude-result-prefixes='xsl xi'>
<xsl:template match="/interfaces">
<html>
<head>
<meta charset="UTF-8" content="text/html" http-equiv="Content-Type"/>
<title>Messages</title>
</head>
<body>
<xsl:apply-templates select="message"/>
</body>
</html>
</xsl:template>
<xsl:template match="message">
<xsl:value-of select="@name"/><br/>
<xsl:apply-templates select="xi:include[@href][@parse='xml' or not(@parse)]" />
</xsl:template>
<xsl:template match="xi:include">
Should be outputed...<xsl:apply-templates select="document(@href)" />
</xsl:template>
</xsl:stylesheet
To process the following xml:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='messages-xsl.xml'?>
<interfaces>
<message name="some_message">
<xi:include href="some_message.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
</message>
</interfaces>
I know that some posts on stackoverflow ask similar questions but i couldn't fix the problem so far. Thanks in advance.