Freigeben über


Example 1 of <xsl:output> 

This is a simple "Hello, World!" demonstration.

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>