Understanding XSLT transformations: Your Own `XML Transformation Utility`
(Page 1 of 6 )
This article mainly concentrates on the basics of transforming XML documents, along with developing your own utility to transform XML to XSLT using Visual Studio 2005.
There are two downloadable files available for this article. You can find them
here and
here.
The obligatory “Hello World” example
I already introduced XML and other related technologies at the following links.
If you are new to XML or XSL, I strongly suggest you go through the theory available at the above links. In this section I start immediately with the “Hello World” example.
The “Hello World” example mainly contains two files. The first would be an XML file (Sample1.xml) and the second would be an XSL file (Sample1.xsl). Let us go through the “Sample1.xml” first.
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="Sample1.xsl"?>
<greeting>
Hello, World!
</greeting>
Let us now look at “Sample1.xsl”:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl=http://www.w3.org/1999/XSL/Transform>
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<body>
<b>
<xsl:value-of select="."/>
</b>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
To execute our example, just open “sample1.xml” in Internet Explorer (version 5.5 or above) and it should give you “Hello World” in bold characters. The next section explains the above two files in detail.
Next: Understanding the XML and XSLT >>
More XML Articles
More By Jagadish Chaterjee