How do XSLT processors evaluate template rules during an XML transformation? Choose the characterization that best describes XSLT’s evaluation model.
-
AContext oriented
-
BProcedural oriented
-
CObject oriented
-
DRelational oriented
Answer
Correct Answer: Context oriented
Explanation
Introduction / Context:XSLT applies template rules to nodes in an XML tree. Each rule is evaluated in a current “context” that includes the current node, position, size, and variable bindings. This question asks for the best description of that evaluation approach.
Given Data / Assumptions:
- XSLT uses XPath to select nodes.
- Template matching uses patterns applied within a context node.
- Instructions like for-each and apply-templates propagate a new context.
Concept / Approach:XSLT is explicitly context oriented. Every expression depends on the current node and context. Unlike procedural or object models, XSLT is declarative and rule-based, with control flow emerging from pattern matches and template priorities.
Step-by-Step Solution:
Recognize that template rules run with a current node and related context.Recall that XPath functions like position() rely on context.Select “Context oriented.”Verification / Alternative check:Review any XSLT example: apply-templates selects a node set; each node gets its own context for matching and processing.
Why Other Options Are Wrong:
- Procedural: XSLT is not about ordered statements but about pattern-driven template invocation.
- Object oriented and Relational oriented: these do not accurately capture XSLT’s matching and context model.
Common Pitfalls:Expecting imperative flow; in XSLT, control is driven by matches and context propagation, not procedural loops alone.
Final Answer:Context oriented