Javatpoint Logo
Javatpoint Logo

XSLT Syntax

Let's take an example to take a sample XML file and transform it into a well formatted HTML document.

See this example:

Create an XML file named employee.xml, having the following code:

Employee.xml

Define an XSLT stylesheet document for the above XML document. You should follow the criteria give below:

  • Page should have a title employee.
  • Page should have a table of employee's details.
  • Columns should have following headers: id, First Name, Last Name, Nick Name, Salary
  • Table must contain details of the employees accordingly.

Step1: Create XSLT document

Create the XSLT document which satisfies the above requirements. Name it as employee.xsl and save it in the same location of employee.xml.

Employee.xsl

Step2: List the XSLT document to the XML document

Update employee.xml document with the following xml-stylesheet tag. Set href value to employee.xsl

Updated "employee.xml"

Step3: View the XML document in Internet Explorer

The output will look like this:

Output:

XSLT Syntax 1
Next TopicXSLT <value-of>




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA