This is a simple "Hello, World!" demonstration.
Note To test this example, you need to use a script. For more information, see Initiate XSLT in a Script.
XML File (hello.xml)
<?xml version='1.0'?> <?xml-stylesheet type="text/xsl" href="hello.xsl"?> <messages> <message>Hello World!</message> </messages>
XSLT File (hello.xsl)
<?xml version='1.0'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <xsl:template match="//message"> <html> <head> <title>Message</title> </head> <body> <p><xsl:value-of select="."/></p> </body> </html> </xsl:template> </xsl:stylesheet>
Output
This is the formatted output:
Hello World!
This is the processor output:
<html> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-16"> <title>Message</title> </head> <body> <p>Hello World!</p> </body> </html>