I am doing a redesign for the squeaknet website which may become the next one for the site, I am trying to use XML to store the content. PHP uses the XML with an XSL Stylesheet to transform the XML into the XHTML of the rest of the site. The transformed XML is simply a fragment of the XHTML as there are some other dynamically created PHP features in the remaining part of the resulting document and I dont want to effect the portability of the content itself.
I have an XML document like this one (I havent yet put the dtd online, but the file is valid)
and I have an XSL file like this one
The problem is I just cant get the attribute information to be displayed and none of the matching templates seem to be being applied, when I run the transformation I simply get the XML document as is but with all the tag elements converted to whitespace.
Anyone got any ideas on what is going wrong with the transformation
I have an XML document like this one (I havent yet put the dtd online, but the file is valid)
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE site-content PUBLIC "-//SN//Design//SITE-CONTENT" "http://stealth-ninja.co.uk/dtd/site-content.dtd">
<site-content version="2.0" xmlns="http://stealth-ninja.co.uk/xml/site-content">
<site name="SqueakNet.net" url="http://squeaknet.net/"/>
<page name="SqueakNet.net IRC Clients">
<content title="mIRC">
<desc>Highly configurable IRC Client with all the goodies of other clients on Unix,
MacOS of even Windows. Multi-Server support, colors, DCC features, configurable keys
and commands, pop-ups, aliases and more. mIRC is shareware but is not crippled in
anyway.<break/>There is also an extensive quantity of scripts designed to extend and
alter mIRC's interface, appearance and operation.
<list type="unorder">
<item>Operating System: Windows</item>
<item>License: Shareware</item>
<item>Evaluation: 30 Days</item>
</list>
</desc>
<ref url="http://www.mirc.com/">mIRC.com</ref>
</content>
<content title="HydraIRC">
<desc>An Opensource IRC project with an attractive and user-friendly interface. Support
for DCC Chat and File Transfer, multiple servers, tabbed windows, channel monitoring
and more.<break/>This Client is currently not completely mature being at a sub v1.0
state, so some configurability and customization are missing.
<list type="unorder">
<item>Operating System: Windows</item>
<item>License: OpenSource</item>
</list>
</desc>
<ref url="http://www.hydrairc.com/">HydraIRC.com</ref>
</content>
<content title="X-Chat">
<desc>A Opensource IRC Client that operates on a diverse range of operating systems. Has
support for scripting languages such as TCL and Perl, as well as Python (with the
right libraries on the host system). Supports multiple servers, colors, DCC and so
on.
<list type="unorder">
<item>Operating System: Windows, Unix, Linux</item>
<item>License: OpenSource for Unix and Linux, Windows is Shareware</item>
<item>Evalutation: 30 Days (Windows) NA (Unix, Linux)</item>
</list>
</desc>
<ref url="http://www.xchat.org/">X-Chat.org</ref>
</content>
<content title="X-Chat Aqua">
<desc>X-Chat Aqua is a very good MacOS client, built and designed to look and feel like
XChat, though development is not by the same development team and the two projects
may grow apart in the future.
<list type="unorder">
<item>Operating System: MacOSX</item>
<item>License: OpenSource</item>
</list>
</desc>
<ref url="http://xchataqua.sourceforge.net">X-Chat Aqua at SourceForge</ref>
</content>
<content title="Snak">
<desc>A MacOS 9+ IRC Client, compatible with OSX. Low memory footprint and disk
requirements. Fully featured with multiple server and scripting support.
<list type="unorder">
<item>Operating System: MacOS 9+ and MacOSX</item>
<item>License: Shareware</item>
<item>Evaluation: 30 Day</item>
</list>
</desc>
<ref url="http://www.snak.com/">Snak.com</ref>
</content>
</page>
</site-content>
and I have an XSL file like this one
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="page">
<span id="pagetitle"><xsl:value-of select="@name"/></span>
<xsl:apply-templates select="content"/>
</xsl:template>
<xsl:template match="content">
<div class="content">
<div class="title"><xsl:value-of select="@title"/></div>
<xsl:apply-templates select="desc"/>
<xsl:apply-templates select="ref"/>
</div>
</xsl:template>
<xsl:template match="desc">
<div class="desc">
<xsl:value-of select="desc"/>
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="break">
<br />
</xsl:template>
<xsl:template match="list[type=order]">
<ol>
<xsl:apply-templates/>
</ol>
</xsl:template>
<xsl:template match="list[type=unorder]">
<ul>
<xsl:apply-templates/>
</ul>
</xsl:template>
<xsl:template match="item">
<li><xsl:value-of select="item"/></li>
</xsl:template>
</xsl:stylesheet>
The problem is I just cant get the attribute information to be displayed and none of the matching templates seem to be being applied, when I run the transformation I simply get the XML document as is but with all the tag elements converted to whitespace.
Anyone got any ideas on what is going wrong with the transformation