1.

How You Define Template In Xslt?

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>

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>



Discussion

No Comment Found