First half page will contain information of the institution.Then I am
having information in following format(with some bullet formatting),
Student Name:
Student Address:
Skill Sets:
Educational Qualification:
Other Personal information:
Currently,it is all in HTML.So every time to add/edit/delete entries.I
have to modify HTML,I do not want to do that.
That is why thinking of switching to XSLT,wherein I will be having XML
file transforming to HTML on this particular part of the page.
*
students.xml
*<?xml version='1.0'?>
<?xml-stylesheet href="students.xsl" type="text/xsl"?>
*
*<students>*
* <one>*
* <name>Himanshu</name>
<addr>ABC</addr>
<skills>PQR</skills>
<education>MS</education>
<other>ZYZ</other>*
* </one>*
*</students>
*
students.xsl *
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" />
<xsl:template match="students">
Print all student information(just copy the previous HTML
code,only retrieve fields from XML)
</xsl:template>
</xsl:stylesheet>
*websitecode.html*
*
<FIRST HALF STATIC PART OF PAGE DISPLAYING INFO. ABOUT INSTITUTION>*
<script>
var processor = new XSLTProcessor();
var testTransform = document.implementation.createDocument("
http://www.w3.org/1999/XSL/Transform", "test", null);
<!-- *Should I give XSL namespace as first argument,what is this second
argument?* -->
testTransform.addEventListener("load", onload, false);
testTransform.load("students.xml");
function onload() {
processor.importStylesheet(testTransform);
}
<!-- *Though 'load' is asynchronous,website code never reaches here.* -->
var newDocument = processor.transformToDocument(testTransform);
<!-- *How should I print the transformed HTML on the page?* -->
</script>
*<LEFT OVER STATIC PART>*
Where does it accepts XSL file or it understands from XML file?
Basically I want code to interpret XML file using XSL and print the
resulting HTML.
---------------------------
Thanks and Regards,
Himanshu Padmanabhi