000-142 Free Dumps Study Materials
Question 10: Consider the following XML document:
<?xml version="1.0" encoding="UTF-8"?>
<Books>
<Book ID="001">
<Title>Finding New World</Title>
<Author>Jone Smith</Author>
</Book>
<Book ID="080">
<Title>How to Programming</Title>
<Author>Tom Alston</Author>
</Book>
</Books>
An XML developer wants to generate a HTML document that lists the ID, title and author of a book in a
HTML table. Which of the following stylesheets can achieve the desired result?
A. <?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="Books">
<html>
<body>
<table width="100%" border="1">
<xsl:for-each select="/">
<tr>
<td><xsl:value-of select="@ID"/></td>
<td><xsl:value-of select="Title" /></td>
<td><xsl:value-of select="Author" /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
B. <?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>
<table width="100%" border="1">
<xsl:for-each select="Books/Book">
<tr>
<td><xsl:value-of select="@ID"/></td>
<td><xsl:value-of select="Title" /></td>
<td><xsl:value-of select="Author" /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
C. <?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>
<table width="100%" border="1">
<xsl:for-each select="Books/Book">
<tr>
<td><xsl:value-of select="ID"/></td>
<td><xsl:value-of select="." /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
D. <?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="Books">
<html>
<body>
<table width="100%" border="1">
<xsl:for-each select="Book">
<tr>
<td><xsl:value-of select="ID"/></td>
<td><xsl:value-of select="Title" /></td>
<td><xsl:value-of select="Author" /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Correct Answer: B