XML Final section 6.3

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Use a choose construction that displays book titles in an h3 heading if they are fiction and an h2 heading if otherwise.

<xsl:choose> <xsl:when test="@category = 'Fiction'"> <h3><xsl:value-of select="title" /></h3> </xsl:when> <xsl:otherwise> <h2><xsl:value-of select="title" /></h2> </xsl:otherwise> </xsl:choose>

What code do you use to create an element named inventory that contains the value 15000?

<xsl:element name="inventory"> 15000 </xsl:element>

What code do you use to create an empty element named inventory that contains a single attribute named amount with the value 15000?

<xsl:element name="inventory"> <xsl:attribute name="amount"> 15000 </xsl:attribute> </xsl:element>

An XML document contains the root element named books, which has a single child element named book. Each book element has two child elements named title and author. Using the XSLT's for-each element, sort the book elements in alphabetical order based on the title.

<xsl:for-each select="/books/book"> <xsl:sort select="title" /> </xsl:for-each>

The book element has a single attribute named category. The value of category can be either fiction or nonfiction. Write an if construction that displays the book title only if it is a nonfiction book.

<xsl:if test="@category = 'Non-fiction'"> <xsl:value-of select="title" /> </xsl:if>

What code do you use to create a processing instruction in the result document linking the result document to an XSLT style sheet named styles.xsl?

<xsl:processing-instruction name="xml-stylesheet"> href="styles.xsl" type="text/xsl" </xsl:processing-instruction>

By default, does the <xsl:sort> element sort items numerically or alphabetically?

Alphabetically

What code do you use to select the first book from the XML document described in Question 1? What do you use to select the last book?

books/book[1] books/book[last()]

Correct the following expression so that it doesn't result in an error: test="sales < 20000"

test="sales &lt; 20000"


Set pelajaran terkait

Biology Unit 1 Part 2 Test Study Guide

View Set

Social/Cultural Diversity (Purple Book)

View Set

Boaters Safety - Practice Exam cards

View Set