XSLT - Overview

Style Sheet Declaration

The root element that declares the document to be an XSL style sheet is 

<xsl:stylesheet> or <xsl:transform>.

Note: <xsl:stylesheet> and <xsl:transform> are completely synonymous and either can be used!

XSL style sheet Declare

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/2001/XMLSchema">

Or

<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/2001/XMLSchema">

XML File

<?xml version="1.0" encoding="UTF-8"?>
<Employees>
  <Details>
    <Name>Kannan</Name>
    <DOB>5th June 1989</DOB>
    <Nationality>INDIA</Nationality>   
  </Details>
.
.
</Employees>
</xml>


Create an XSL Style Sheet


<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/2001/XMLSchema">

<xsl:template match="/">
  <html>
  <body> 
  <table border="1">
    <tr bgcolor="Blue">
      <th>Name</th>
      <th>DOB</th>
      <th>Nationality</th>
    </tr>
    <xsl:for-each select="Employees/Details">
    <tr>
      <td><xsl:value-of select="title"/></td>
      <td><xsl:value-of select="artist"/></td>
    </tr>
    </xsl:for-each>
  </table>
  </body>
  </html>
</xsl:template>

</xsl:stylesheet>



Comments

Popular posts from this blog

IRM and the Object Model

This content database has a schema version which is not supported in this farm

Activate and Deactivate Feature through PowerShell