XSLT (XSL Transformations) Question:
Download Questions PDF

How you define template in XSLT?

XSLT Interview Question
XSLT Interview Question

Answer:

When XSL style sheet has one or more set of rules are told as templates.
We used <xsl:template> element to create templates.
We can attach a template with an XML document by using match attribute.The match attribute value is an XPath exprssion.Like: match="/" use to define whole document.
Example:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2> Book Collection </h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Author</th>
</tr>
<tr>
<td>.</td>
<td>.</td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Download XSLT Interview Questions And Answers PDF

Previous QuestionNext Question
How to use <xsl:sort>element in XSLT?How to transform an XML into XHTML?