How To Include Xsl in Xml
The following xsl is a very basic code sample to demonstrate the xslt include in xml:
<?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="mytext"> <h1> <xsl:value-of select="myhead" /> </h1> <p> <xsl:value-of select="mypara" /> </p> </xsl:template> </xsl:stylesheet>
<?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="style.xslt"?> <mytext> <myhead>Demo: How To Include Xsl in Xml</myhead> <mypara>This demonstrates the way to include the xslt so it renders in the browser with a readable format.</mypara> </mytext>
Save the above XML as data.xml and the xsl code as style.xslt. And then see the following output in the browser.
To view in browser, select the data.xml file and right click then select Open with> Internet Explorer (or your favorite browser)
Demo: How To Include Xsl in Xml
This demonstrates the way to include the xslt so it renders
in the browser with a readable format.