XSLT file frame
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<!-- content -->
</xsl:stylesheet>
More info and samples on: www.devarchweb.net
Reference from XML to XSL<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="myStyle.xsl" type="text/xsl"?>
<people>
<!-- content -->
</people>
More info and samples on: www.devarchweb.net
Output all XML data<?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" encoding="utf-8"/>
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
More info and samples on: www.devarchweb.net
Modify output of one element<?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" encoding="utf-8"/>
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="department">
<b><xsl:value-of select="."/></b><br/>
</xsl:template>
</xsl:stylesheet>
More info and samples on: www.devarchweb.net
Using xsl:if<xsl:template match="person">
<xsl:if test="department='IT'>
<xsl:value-of select="department"/>
<xsl:if/>
</xsl:template>
More info and samples on: www.devarchweb.net
Using xsl:choose<xsl:template match="person">
<xsl:choose>
<xsl:when test="department='IT'">
<i><xsl:apply-templates /></i>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
More info and samples on: www.devarchweb.net
List all persons in sorted order<xsl:template match="/">
<html>
<body>
<xsl:for-each select="//person">
<xsl:sort select="@id"/>
<xsl:value-of select="lastName"/>
</xsl:for-each>
</body>
</html>
</xsl:template>
More info and samples on: www.devarchweb.net
Call template as procedure<!-- caller -->
<xsl:call-template name="CreateLink">
<xsl:with-param name="reference" select="http://mysite" />
<xsl:with-param name="title" select="Go to my site."/>
</xsl:call-template>
<!-- "procedure" -->
<xsl:template name="CreateLink">
<xsl:param name="reference" />
<xsl:param name="title" />
<xsl:text disable-output-escaping="yes"><a href="</xsl:text>
<xsl:value-of select="$reference" />
<xsl:text disable-output-escaping="yes">">/xsl:text>
<xsl:value-of select="$title" />
<xsl:text disable-output-escaping="yes"</a></xsl:text>
</xsl:template>