What is the purpose of `<xsl:template>` in XSLT?
A
To define variables B
To match and transform specific XML nodes C
To import external stylesheets D
To create new XML schemas
Analysis & Theory
`<xsl:template>` defines a rule to transform nodes that match a specific pattern in the XML document.
Which attribute is required in `<xsl:template>` to define what it applies to?
A
select B
value C
match D
name
Analysis & Theory
The `match` attribute tells the XSLT processor which XML elements the template applies to.
What does `<xsl:template match="/">` typically match?
A
All nodes B
The current node C
The root node D
Every child node
Analysis & Theory
`<xsl:template match="/">` matches the root node of the XML document.
How do you define a named template in XSLT?
A
<xsl:template name="templateName"> B
<xsl:template match="templateName"> C
<xsl:template id="templateName"> D
<xsl:template type="named">
Analysis & Theory
`name` is used to define a reusable template that can be called using `<xsl:call-template>`.
Which element is used to invoke a named template?
A
<xsl:call-template name="..." /> B
<xsl:apply-templates select="..." /> C
<xsl:include-template name="..." /> D
<xsl:use-template name="..." />
Analysis & Theory
`<xsl:call-template>` is used to call a template by name.
Can you define multiple `<xsl:template>` elements with different `match` values?
A
Yes, but only one will be used B
Yes, each handles a different part of the XML tree C
No, only one `<xsl:template>` is allowed D
Yes, but only if they are nested
Analysis & Theory
You can define multiple templates with different `match` values to handle different parts of the XML.
What happens if multiple `<xsl:template>` rules match the same node?
A
The last one in the file is used B
An error is thrown C
The most specific match is used based on priority D
All matching templates are applied
Analysis & Theory
If multiple templates match the same node, XSLT uses the most specific one, or the one with the highest `priority`.