nimbus3
04-30-2007, 05:27 PM
Good evening all
I know this might appear to be a real nooB question/issue, but alas i am a nooB concerning xml/xsl etc etc.
I have created an xsl file, contents shown bellow, when i insert a simple script to take the user to the First/previous/next/last node in the xml file and display in a browser i recieve the follow error:
A name contained an invalid character. Error processing resource 'file:///C:/Users/Phil/Desktop/NIKS_XML_Assignment/NS/cour...
if(x.absoluteposition<x.recordcount){x.movenext();}
-------------------------------------^
The code looks like this:
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- DWXMLSource="coursesb.xml" -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
<!ENTITY copy "©">
<!ENTITY reg "®">
<!ENTITY trade "™">
<!ENTITY mdash "—">
<!ENTITY ldquo "“">
<!ENTITY rdquo "”">
<!ENTITY pound "£">
<!ENTITY yen "¥">
<!ENTITY euro "€">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="iso-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<xsl:template match="/">
<!-- data island to hold contents of XML file -->
<xml id="xmlDSO" src="coursesb.xml" async="false"/>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>Untitled Document</title>
<script language="javascript">
function moveFirst(x){
x.moveFirst();
}
function moveNext(x){
//check that we are not at the end before moving on
if(x.absoluteposition<x.recordcount){x.movenext();}
}
function movePrev(x){
//check that we are not at the beginning before moving back
if (x.absoluteposition > 1) {
x.moveprevious();
}
}
function moveLast(x){
x.movelast();
}
</script>
</head>
<body>
<p> <xsl:value-of select="fe_colleges/college/name"/><br />
<xsl:value-of select="fe_colleges/college/address_1"/><br />
<xsl:value-of select="fe_colleges/college/address_2"/><br />
<xsl:value-of select="fe_colleges/college/postcode"/><br />
<xsl:value-of select="fe_colleges/college/telephone"/><br />
</p>
<table width="400" border="2" cellspacing="1" cellpadding="1">
<tr>
<td width="100">Department</td>
<td>
<p><xsl:value-of select="fe_colleges/college/department_name/name"/> </p>
</td>
</tr>
<tr>
<td width="100">Course Name </td>
<td><xsl:value-of select="fe_colleges/college/department_name/course_name/name"/></td>
</tr>
<tr>
<td width="100">Course Code </td>
<td><xsl:value-of select="fe_colleges/college/department_name/course_name/course_code_design"/></td>
</tr>
<tr>
<td width="100">Duration</td>
<td><xsl:value-of select="fe_colleges/college/department_name/course_name/duration"/></td>
</tr>
<tr>
<td width="100">Level</td>
<td><xsl:value-of select="fe_colleges/college/department_name/course_name/level"/></td>
</tr>
<tr>
<td width="100">Location</td>
<td><xsl:value-of select="fe_colleges/college/department_name/course_name/location"/></td>
</tr>
<tr>
<td width="100">Awarding Body </td>
<td><xsl:value-of select="fe_colleges/college/department_name/course_name/awarding_body"/></td>
</tr>
</table>
<p>
<!-- Buttons for navigation -->
<input type="button" value="First" onClick="moveFirst(xmldso.recordset);" />
<input type="button" value="Previous" onClick="movePrev(xmldso.recordset);" />
<input type="button" value="Next" onClick="moveNext(xmldso.recordset);" />
<input type="button" value="Last" onClick="moveLast(xmldso.recordset);" />
</p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
I do have other problems (i.e. understanding how XML SCHEMA works in conjunction with xsl) but will research this further before asking any question.
Any help is greatly appreciated
Regards
Nimbus3
I know this might appear to be a real nooB question/issue, but alas i am a nooB concerning xml/xsl etc etc.
I have created an xsl file, contents shown bellow, when i insert a simple script to take the user to the First/previous/next/last node in the xml file and display in a browser i recieve the follow error:
A name contained an invalid character. Error processing resource 'file:///C:/Users/Phil/Desktop/NIKS_XML_Assignment/NS/cour...
if(x.absoluteposition<x.recordcount){x.movenext();}
-------------------------------------^
The code looks like this:
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- DWXMLSource="coursesb.xml" -->
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
<!ENTITY copy "©">
<!ENTITY reg "®">
<!ENTITY trade "™">
<!ENTITY mdash "—">
<!ENTITY ldquo "“">
<!ENTITY rdquo "”">
<!ENTITY pound "£">
<!ENTITY yen "¥">
<!ENTITY euro "€">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="iso-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<xsl:template match="/">
<!-- data island to hold contents of XML file -->
<xml id="xmlDSO" src="coursesb.xml" async="false"/>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>Untitled Document</title>
<script language="javascript">
function moveFirst(x){
x.moveFirst();
}
function moveNext(x){
//check that we are not at the end before moving on
if(x.absoluteposition<x.recordcount){x.movenext();}
}
function movePrev(x){
//check that we are not at the beginning before moving back
if (x.absoluteposition > 1) {
x.moveprevious();
}
}
function moveLast(x){
x.movelast();
}
</script>
</head>
<body>
<p> <xsl:value-of select="fe_colleges/college/name"/><br />
<xsl:value-of select="fe_colleges/college/address_1"/><br />
<xsl:value-of select="fe_colleges/college/address_2"/><br />
<xsl:value-of select="fe_colleges/college/postcode"/><br />
<xsl:value-of select="fe_colleges/college/telephone"/><br />
</p>
<table width="400" border="2" cellspacing="1" cellpadding="1">
<tr>
<td width="100">Department</td>
<td>
<p><xsl:value-of select="fe_colleges/college/department_name/name"/> </p>
</td>
</tr>
<tr>
<td width="100">Course Name </td>
<td><xsl:value-of select="fe_colleges/college/department_name/course_name/name"/></td>
</tr>
<tr>
<td width="100">Course Code </td>
<td><xsl:value-of select="fe_colleges/college/department_name/course_name/course_code_design"/></td>
</tr>
<tr>
<td width="100">Duration</td>
<td><xsl:value-of select="fe_colleges/college/department_name/course_name/duration"/></td>
</tr>
<tr>
<td width="100">Level</td>
<td><xsl:value-of select="fe_colleges/college/department_name/course_name/level"/></td>
</tr>
<tr>
<td width="100">Location</td>
<td><xsl:value-of select="fe_colleges/college/department_name/course_name/location"/></td>
</tr>
<tr>
<td width="100">Awarding Body </td>
<td><xsl:value-of select="fe_colleges/college/department_name/course_name/awarding_body"/></td>
</tr>
</table>
<p>
<!-- Buttons for navigation -->
<input type="button" value="First" onClick="moveFirst(xmldso.recordset);" />
<input type="button" value="Previous" onClick="movePrev(xmldso.recordset);" />
<input type="button" value="Next" onClick="moveNext(xmldso.recordset);" />
<input type="button" value="Last" onClick="moveLast(xmldso.recordset);" />
</p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
I do have other problems (i.e. understanding how XML SCHEMA works in conjunction with xsl) but will research this further before asking any question.
Any help is greatly appreciated
Regards
Nimbus3