Name: 
 

Study Guide 08



True/False
Indicate whether the sentence or statement is true or false.
 

 1. 

The step pattern descendant::property selects all nodes that are descendants of the context node, starting with the node’s immediate children and moving up the node tree.
 

 2. 

The step pattern descendant-or-self::property selects all nodes that are descendants of the context node, starting with the context node and moving up the node tree.
 

 3. 

The processor creates a node set when it evaluates a step pattern.
 

 4. 

Generally, the processor moves left or right on the node tree before moving up or down.
 

 5. 

When constructing the step pattern properly, you can create node sets selecting a wide range of elements from the node tree.
 

 6. 

When the XSLT processor encounters two templates with the same name, it uses both.
 

 7. 

Once you generate the list of unique values, you can use the <xsl:apply-templates> element or the <xsl:for> element to write code to the result document for each unique value.
 

 8. 

XPath expressions are always very efficient in creating node sets from the source document’s node tree.
 

 9. 

Declaring an attribute as an ID requires the processor to verify that all attributes declared as IDs have unique values--unless they are associated with different elements in the source document, in which case unique values are not necessary.
 

 10. 

The process of ensuring unique ID values instructs the XML processor to create an index that matches each element with its ID attribute value.
 

 11. 

An important point to remember about ID attributes is that all IDs belong to the same index.
 

 12. 

All XML parsers create an index of ID attribute values and their matching elements.
 

 13. 

When you use the id() function, the index can be created based on the values of an element or values of the children of the element.
 

 14. 

You must create a unique ID for each of the ID attributes, unless they are associated with different elements.
 

 15. 

Relying on ID attributes and the id() function is typically the most flexible and useful way to search for specific node sets.
 

 16. 

Unlike IDs, keys are declared in the DTD of the source document, not in the style sheet.
 

 17. 

Unlike IDs, keys have names as well as values.
 

 18. 

Like IDs, keys can be associated with node sets that contain attribute and element values.
 

 19. 

Unlike IDs, the names of keys are limited to XML names.
 

 20. 

You cannot create a key based on the value of a child element.
 

 21. 

A key cannot point to more than one node.
 

 22. 

One advantage of using an ID is that is accesses the node set more efficiently than a key and can be easily reused without having to regenerate the node set.
 

 23. 

If you omit a node-set, the generate-id() function is applied to the current context node.
 

 24. 

If two node sets share the same generated ID, they cannot be the same node set.
 

 25. 

When you use the generate-id() function, the same text string is generated each time the style sheet is accessed.
 

 26. 

It is common practice to create a variable for an external document, so that you can access the external document without having to reuse the document() function.
 

 27. 

When retrieving data from secondary source documents, it is important to keep track of the context node because within the property template, the context node is the property element.
 

 28. 

It can be easier to manage a single file rather than several, which is why some XML authors decide to use external XML data sources instead of data elements.
 

 29. 

A data element should be placed in its own namespace with a namespace prefix to distinguish it from other types of elements in the style sheet.
 

Modified True/False
Indicate whether the sentence or statement is true or false.  If false, change the identified word or phrase to make the sentence or statement true.
 

 30. 

In a step pattern, only the predicate part of the step pattern is required. _________________________

 

 31. 

The expression property[city=“Belmont”] has a predicate of property. _________________________

 

 32. 

If you want to apply a step pattern to the siblings or ancestor elements, and not to the context node’s descendants, you must work with the node-test part of the step pattern. _________________________

 

 33. 

The general syntax of a step pattern is axis::node-test[predicate], where axis defines how to move through the node tree. _________________________

 

 34. 

For the axis part of the step pattern, the value parent instructs the processor to select the children of the context node that match the node-test and predicate. _________________________

 

 35. 

From the perspective of the processor, the expression
 
child

is equivalent to the expression
 
child::property. _________________________

 

 36. 

The step pattern node::property selects the context node. _________________________

 

 37. 

The step pattern before::property selects all nodes that appear before the context node in the source document, excluding the context node’s own ancestors of the context node. _________________________

 

 38. 

The step pattern after::property selects all nodes that appear after the context node in the source document, excluding the context node’s own descendants. _________________________

 

 39. 

The step pattern child::property selects all children of the context node. _________________________

 

 40. 

For some step patterns, the processor recognizes a(n) abbreviated form. _________________________

 

 41. 

To reverse a node set, we use the XPath reverse() function. _________________________

 

 42. 

When the XSLT processor encounters two templates with the same name, it uses the first one defined in the style sheet. _________________________

 

 43. 

To convert a template named “city-list” into a moded template, you would introduce the following template code:
 
<xsl:template match=“property” mode=“citylist”>.
_________________________

 

 44. 

To avoid the id() function returning an empty result, ensure that only a(n) non-validating XML parser works with the source document. _________________________

 

 45. 

Like IDs, keys are not limited to attributes. _________________________

 

 46. 

Data placed within the style sheet are known as data indices. _________________________

 

 47. 

Data elements should be placed in the bottom level of the style sheet, as direct children of the <xsl:stylesheet> element. _________________________

 

 48. 

One of the advantages of creating code snippets is that they can be easily modified without having to edit the style sheets directly. _________________________

 

Multiple Choice
Identify the letter of the choice that best completes the statement or answers the question.
 

 49. 

XPath allows for the construction of more node sets through the creation of a ____ path.
a.
property
b.
step
c.
pattern
d.
location
 

 50. 

The expression property[city=“Belmont”] has a predicate of ____.
a.
Belmont
b.
city=“Belmont”
c.
city
d.
property
 

 51. 

If you want to apply a pattern to the siblings or ancestor elements, and not to a context node’s descendants, you must work with the ____ part of the step pattern.
a.
axis
b.
predicate
c.
property
d.
node-test
 

 52. 

In a step pattern, the ____ further tests the nodes to see if they match a particular pattern.
a.
axis
b.
predicate
c.
property
d.
node-test
 

 53. 

XPath supports ____ values for the axis part of the step pattern.
a.
13
b.
17
c.
19
d.
22
 

 54. 

The default value for the axis part of the step pattern is ____.
a.
child
b.
parent
c.
self
d.
property
 

 55. 

From the perspective of the processor, the ____ expression is equivalent to the property expression.
a.
parent::property
b.
self::property
c.
child::property
d.
All of the above
 

 56. 

The step pattern axis ____ selects all nodes that are ancestors of the context node, starting with the context node’s parents and moving up the node tree.
a.
ancestor-or-self
b.
attribute
c.
child
d.
ancestor
 

 57. 

The step pattern axis ____ selects all nodes that are ancestors of the context node, starting with the context node and moving up the node tree.
a.
namespace
b.
ancestor
c.
ancestor-or-self
d.
self
 

 58. 

The step pattern axis ____ selects all attribute nodes of the context node.
a.
attribute
b.
context
c.
node
d.
self
 

 59. 

The step pattern axis ____ selects all nodes that are descendants of the context node, starting with the node’s immediate children and moving down the node tree.
a.
descendant-or-self
b.
namespace
c.
descendant
d.
following
 

 60. 

The step pattern axis ____ selects all nodes that are descendants of the context node, starting with the context node and moving down the node tree.
a.
descendant-or-self
b.
following-sibling
c.
parent
d.
following
 

 61. 

The step pattern axis ____ selects all nodes that appear after the context node in the source document, excluding the context node’s own descendants.
a.
following
b.
descendant
c.
descendant-or-self
d.
attribute
 

 62. 

The step pattern axis ____ selects all siblings of the context node that appear after the context node in the source document.
a.
post-sibling
b.
following-sibling
c.
after-sibling
d.
next-sibling
 

 63. 

The step pattern axis ____ selects all namespace nodes of the context node.
a.
context
b.
current
c.
attribute
d.
namespace
 

 64. 

The step pattern axis ____ selects the parent of the context node.
a.
parent
b.
above
c.
self
d.
current
 

 65. 

The step pattern axis ____ selects all nodes that appear before the context node in the source document, excluding the context node’s own ancestors of the context node.
a.
preceding
b.
preceding-sibling
c.
self
d.
antecedent
 

 66. 

The step pattern axis ____ selects all siblings of the context node that appear before the context node in the source document.
a.
self
b.
preceding-sibling
c.
following-sibling
d.
ancestor-or-self
 

 67. 

The step pattern axis ____ selects the context node.
a.
current
b.
self
c.
this
d.
child
 

 68. 

The step pattern ____ selectors ancestors of the context node named “property.”
a.
ancestor/property
b.
ancestor(property)
c.
ancestor--property
d.
ancestor::property
 

 69. 

What is the abbreviation for the step pattern self::node()?
a.
%
b.
/
c.
*
d.
.
 

 70. 

What is the abbreviation for the step pattern parent::node()?
a.
.
b.
..
c.
//
d.
@
 

 71. 

What is the abbreviation for the step pattern child::property/child::city?
a.
property/@city
b.
../property/city
c.
property/city
d.
../property/@city
 

 72. 

What is the abbreviation for the step pattern child::listings/descendant::city?
a.
listings//city
b.
listings(city)
c.
listings::city
d.
listings/city
 

 73. 

What is the abbreviation for the step pattern property/attribute::firm?
a.
property/@firm
b.
property(firm)
c.
property//firm
d.
property..firm
 

 74. 

What is the abbreviation for the step pattern parent::node()/property/attribute::firm?
a.
property/firm
b.
../property/@firm
c.
property/@firm
d.
property//firm
 

 75. 

Which XPath function would you use to reverse a node set?
a.
not()
b.
return()
c.
reverse()
d.
undo()
 

 76. 

One way for the XSLT processor to differentiate between two property templates is by using a(n) ____ template.
a.
indexed
b.
modular
c.
unique
d.
moded
 

 77. 

The syntax for a(n) ____ template is <xsl:template match=“node” mode=“mode”> template code </xsl:template>.
a.
moded
b.
matched
c.
applied
d.
indexed
 

 78. 

To apply a moded template, simply include the mode’s value in the ____ element.
a.
<xsl:template>
b.
<xsl:apply-templates>
c.
<xsl:document>
d.
<xsl:mode>
 

 79. 

XML allows you to validate the contents of an XML document by creating a(n) ____.
a.
ATTLIST
b.
ID set
c.
property range
d.
DTD
 

 80. 

One item you can declare in a DTD is a(n) ____ attribute, which provides a way to uniquely identify a particular item from the source document.
a.
range
b.
element
c.
indexed
d.
ID
 

 81. 

If you want to declare an attribute called “msd” as an ID and require every property element to have an msd attribute, you can create a DTD containing the following declaration: ____.
a.
<!ATTLIST property msd ID #REQUIRED>
b.
<!DTD property msd ID #REQUIRED>
c.
<!DECLARE property msd ID #REQUIRED>
d.
<!SELECT property msd ID #REQUIRED>
 

 82. 

What is the XPath function to search the index?
a.
search(index)
b.
id(value)
c.
search(value)
d.
index(id)
 

 83. 

The ____ function returns a node set with nodes whose ID attributes match the value specified in the function.
a.
attlist()
b.
nodeset()
c.
id()
d.
return()
 

 84. 

When an index of ID attributes values and their matching elements has not been created by a non-validating XML parser, the ____ function will always return an empty result.
a.
key()
b.
name()
c.
for-each()
d.
id()
 

 85. 

IDs can only be ____.
a.
indices
b.
attributes
c.
processes
d.
numerical
 

 86. 

Which is true of IDs?
a.
IDs cannot be attributes.
b.
Using IDs can accelerate searches considerably.
c.
ID attributes cannot be XML names.
d.
All of the above
 

 87. 

Which of the following is NOT true of IDs?
a.
A non-validating XML parser does not create an index of ID attribute values and their matching elements.
b.
You must create a unique ID for each of the ID attributes, even if they are associated with different elements.
c.
ID attributes can contain spaces and begin with numbers.
d.
Both B and C
 

 88. 

Which of the following is a valid ID attribute?
a.
b674112
b.
015568337
c.
1600penn
d.
help poll
 

 89. 

____ can be thought of as generalized IDs, without their limitations.
a.
Keys
b.
Values
c.
Parameters
d.
Variables
 

 90. 

To access values from a key, use the function: ____.
a.
key(name)
b.
key(“name”, “value”)
c.
key(value)
d.
key(“value”, “name”)
 

 91. 

When the processor encounters the ____ element in the style sheet, it builds an index based on the key’s definition.
a.
<xsl:new_key>
b.
<xsl:key-create>
c.
<xsl:key>
d.
<xsl:key-build>
 

 92. 

One advantage of ____ grouping is that it is usually more efficient that the use of step patterns so it is worth considering when you need to organize data from a large source document.
a.
Oracle
b.
Muenchian
c.
context
d.
perceptual
 
 
studyguide08_files/i0960000.jpg
 

 93. 

The code indicated in the figure above creates a hypertext ____.
a.
target
b.
link
c.
result document
d.
selection statement
 

 94. 

In the document() function, if no value for ____ is specified, the external document is assumed to be in the same folder as the style sheet.
a.
object
b.
base
c.
value
d.
folder
 

 95. 

In the document() function, the base parameter defines the base ____ used for resolving relative references.
a.
URI
b.
HTTP
c.
URL
d.
protocol
 

 96. 

One advantage of the use of the ____ function is that if you need to access different external documents, or update the location of an external document, you can do so through the XML source file, leaving the style sheet unchanged.
a.
key()
b.
copy-of()
c.
update()
d.
document()
 

 97. 

In the general syntax of the <xsl:stylesheet> element, the data_namespace parameter is the ____ of the namespace.
a.
URI
b.
URL
c.
target
d.
protocol
 

 98. 

To use code from a code snippet, you need to use the document() function to access the document and the ____ element to insert the node set into the result document.
a.
<xsl:result>
b.
<xsl:addnode>
c.
<xsl:insert>
d.
<xsl:copy-of>
 

Completion
Complete each sentence or statement.
 

 99. 

A(n) ____________________ path is an expression that defines a path for the processor to navigate through the source document’s node tree.
 

 

 100. 

With XPath, you can use complicated paths, called ______________________________, to allow the processor to travel through the node tree.
 

 

 101. 

The general syntax of a(n) ____________________ pattern is axis::node-test[predicate].
 

 

 102. 

____________________ supports 13 values for the axis part of the step pattern.
 

 

 103. 

Self, preceding-sibling, parent, and following are all examples of step pattern ____________________.
 

 

 104. 

The following::property step pattern selects all nodes that appear after the context node in the source document, excluding the context node’s own ____________________.
 

 

 105. 

The preceding::property step pattern selects all nodes that appear before the context node in the source document, excluding the context node’s own ____________________ of the context node.
 

 
 
studyguide08_files/i1110000.jpg
 

 106. 

The items shown in the figure above are step pattern ____________________ charts.
 

 

 107. 

____________________ templates are templates that apply different code to the same node set in the source document.
 

 

 108. 

To apply a(n) ____________________ template, include the mode’s value in the <xsl:apply-templates> element.
 

 

 109. 

DTD stands for ______________________________.
 

 

 110. 

One possible syntax for declaring an ID attribute is <!____________________ element attribute ID #REQUIRED>.
 

 

 111. 

When an ID attribute is declared, the attribute can be required (#REQUIRED) or optional (____________________).
 

 

 112. 

A(n) ____________________ is an index that matches values of either an element or an attribute with nodes in the source document.
 

 

 113. 

The generate-id() and key() functions can be used together to efficiently create groups of nodes from the source document; this technique is known as ____________________ grouping.
 

 
 
studyguide08_files/i1200000.jpg
 

 114. 

The code highlighted in the figure above is used for ____________________ the properties.
 

 
 
studyguide08_files/i1220000.jpg
 

 115. 

The code highlighted in the figure above is for creating a hypertext ____________________.
 

 

 116. 

Data placed within the style sheet are known as data ____________________.
 

 

 117. 

Data elements should be placed in the ____________________ level of the style sheet, as direct children of the <xsl:stylesheet> element.
 

 

Matching
 
 
Identify the letter of the choice that best matches the phrase or definition.
a.
location path
e.
Muenchian grouping
b.
step pattern
f.
data element
c.
moded template
g.
child
d.
key
h.
not()
 

 118. 

Complicated paths that XPath provides to allow the processor to navigate through the node tree
 

 119. 

Default value for the axis part of an XPath step pattern
 

 120. 

An index that matches values of either an element or an attribute with nodes in the source document
 

 121. 

XPath function used to reverse a node set
 

 122. 

Data placed within the style sheet
 

 123. 

Usually more efficient than the use of step patterns in organizing data from a large source document
 

 124. 

Expression that enables a processor to navigate through the source document’s node tree
 

 125. 

Applies different code to the same node set in the source document
 



 
Check Your Work     Reset Help