Answers

Question and Answer:

  Home  XSLT

⟩ How you define template in XSLT?

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>

 182 views

More Questions for you: