XML to HTML page
-
I trie to display a greeting Message in an html by redaing the words from xml.This was a my first simple progrma on xml.Use XMLDOM to load xml and xsl to memory.Transfomed into html. The html page dispplay only words of greeting.It doesn't display the text read from xml. This my xsl code:
words of greeting: xsl:value-of select="greeting"
The Xml code
Hello world.
Praveen
-
I trie to display a greeting Message in an html by redaing the words from xml.This was a my first simple progrma on xml.Use XMLDOM to load xml and xsl to memory.Transfomed into html. The html page dispplay only words of greeting.It doesn't display the text read from xml. This my xsl code:
words of greeting: xsl:value-of select="greeting"
The Xml code
Hello world.
Praveen
You have to change your <'s to <'s and >'s to >'s. We can't see your XML text.
-
You have to change your <'s to <'s and >'s to >'s. We can't see your XML text.
The Xsl stylesheet File used by xml to display html page
<?xml version="1.0"?><!--hellohtm.xsl-->
<html xmlns:xsl="http://www.w3.org/1999/xsl/transform" xsl:version="1.0">
<head><title>Greeting</title></head>
<body><p> words of greeting:<br/>
<b><i><u><xsl:value-of select="greeting"/></u></i></b>
</p>
</body>
</html>The Xml file hodliing greeting message to be printed
<?xml version="1.0"?>
<?xml-stylesheet type="type/xsl" href="Hello.xsl"?>
<greeting>Hello world.</greeting>The Html page should display the greeting message read from the xml file:" The page displays only the word of greeting on the page it must also display the xml greeting message Hello World."
<html>
<body>
<script language="javascript">
// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
xml.load("Hello.xml")// Load the XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("Hello.xsl")// Transform
document.write(xml.transformNode(xsl))
</script></body>
</html>Praveen
-
The Xsl stylesheet File used by xml to display html page
<?xml version="1.0"?><!--hellohtm.xsl-->
<html xmlns:xsl="http://www.w3.org/1999/xsl/transform" xsl:version="1.0">
<head><title>Greeting</title></head>
<body><p> words of greeting:<br/>
<b><i><u><xsl:value-of select="greeting"/></u></i></b>
</p>
</body>
</html>The Xml file hodliing greeting message to be printed
<?xml version="1.0"?>
<?xml-stylesheet type="type/xsl" href="Hello.xsl"?>
<greeting>Hello world.</greeting>The Html page should display the greeting message read from the xml file:" The page displays only the word of greeting on the page it must also display the xml greeting message Hello World."
<html>
<body>
<script language="javascript">
// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
xml.load("Hello.xml")// Load the XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("Hello.xsl")// Transform
document.write(xml.transformNode(xsl))
</script></body>
</html>Praveen
Excellent, that helps a lot. You have to divide the XML from the XSL. Here's what the XML should look like:
<?xml version="1.0" encoding="utf-8"?>
<greeting>Hello world.</greeting>And here's an example XSL:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:value-of select="greeting"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>You had the XSL tags in the XML source document. The XML source document should be free-form, meaning that it can be pretty much anything as long as it's legal XML. The XSL is the transform and is pretty specific to the input and output expected. Check out zvon[^] or w3schools[^] for some tutorials on XSL.
-
Excellent, that helps a lot. You have to divide the XML from the XSL. Here's what the XML should look like:
<?xml version="1.0" encoding="utf-8"?>
<greeting>Hello world.</greeting>And here's an example XSL:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:value-of select="greeting"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>You had the XSL tags in the XML source document. The XML source document should be free-form, meaning that it can be pretty much anything as long as it's legal XML. The XSL is the transform and is pretty specific to the input and output expected. Check out zvon[^] or w3schools[^] for some tutorials on XSL.
Thanks, it is displaying
Praveen