help using saxon to get some XSLT code to work
Hi, I have already read some of the other posts on here, and they recommended using saxon. This is for some work im doing in my third year of uni doing some work on XML, XSLT etc.. but i dont want the answers, just some help in getting saxon to do something so I can see where im going wrong!
I have tried to use some XSLT code I found online, which uses the Muenchian Method to group data in an XML document in a particular way. I got a simple bit of XSLT code to work in IE, but every time i try the code I found online it gives me the error : Keyword xsl:stylesheet may not contain PCDATA nodes.
So I then found this forum, and tried using saxon to see if that fixed it.
However, I have managed to install saxon, but then am not sure how to get it to check my code.
I may be doing something really stupid, but there doesn't seem to be much documentation out there, or if there is, its quite complex.
any help would be appreciated ;)
The XML im using is:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="collegestaff2.xsl"?>
<collegestaff>
<department dname="Computer Science" code="dcs">
<staff>
<sname>Steve Barker</sname>
<title>Lecturer</title>
<tel>1587</tel>
</staff>
<staff>
<sname>David Clark</sname>
<title>Lecturer</title>
<tel>2472</tel>
</staff>
</department>
<department dname="Philosophy" code="philosophy">
<staff>
<sname>Peter Adamson</sname>
<title>Dr</title>
<tel>2118</tel>
</staff>
<staff>
<sname>John Milton</sname>
<title>Professor</title>
<tel>2340</tel>
</staff>
</department>
</collegestaff>
and the xslt im trying to get working is:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="collegestaff" match="department" use="dname"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="collegestaff">
<xsl:call-template name="Style"/>
-
<h2>
College Members of Staff
</h2>
<xsl:for-each select="//department[generate-id(.)=generate-id(key('collegestaff',dname))]">
<xsl:sort select="tel" order="descending"/>
<h3>
Department of
<xsl:value-of select="department"/>
</h3>
<table border="1">
-
<tr>
<th>Name</th>
<th>Job Title</th>
<th>Tel</th>
</tr>
<xsl:for-each select="key('staff',dname)">
<xsl:sort select="tel"/>
<tr>
<td>
<xsl:value-of select="sname"/>
</td>
<td>
<xsl:value-of select="title"/>
</td>
<td>
<xsl:value-of select="tel"/>
</td>
</tr>
</xsl:for-each>
</table>
<br/>
<br/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
|