|
Home >Online Product Documentation >Table of Contents >Understanding How the Default Templates Work Understanding How the Default Templates WorkThis topic is part of a sequence that starts with Creating a New Sample Stylesheet.
After you complete the steps in the previous section, you can see the The stylesheet explicitly contains one template, which matches the root node. When the XSLT processor applies a stylesheet, the first thing it does is search for a template that matches the root node. If there is no template that explicitly matches the root node, the XSLT processor uses a built-in template. There are two built-in templates, also called default templates. Every XSLT stylesheet contains these templates whether or not they are explicitly specified. This is part of the W3C XSLT Recommendation. This section discusses the following topics: Instantiating the Template That Matches the Root Node
The XSLT processor instantiates the template that matches the root node. The template that matches the root node contains only the Unless you specify otherwise, the XSLT processor operates on the children in document order. The first child is a processing instruction (the XML declaration). The XSLT processor ignores processing instructions. The second child is the comment node, and the XSLT processor also ignores comment nodes.
The third child is the Instantiating the Root/Element Default Template
One default template matches
The root/element default template contains only the
In this case, the root/element default template was instantiated for the
The XSLT processor operates on these children in document order. First, it searches for a template that matches
Again, by default, the
In the first At this point, the XSLT processor has initiated instantiation of the root template once, and the root/element default template several times: It is important to understand that these instantiations are not yet complete. Each subsequent instantiation of the root/element default template is inside the previous instantiations. Instantiating the Text/Attribute Default Template
When the XSLT processor instantiates the root/element default template for the
The XSLT processor instantiates the text/attribute default template for the Now the result document contains the following text:
The XSLT processor is finished with the
The XSLT processor is finished with the Illustration of Template Instantiations
As you can see from the description in the previous section, the XSLT processor iterates through the process of searching for a matching template, instantiating one of the default templates, and operating on the children of the node for which the template was instantiated. The following figure shows the template instantiations through the second |
Validating X12 Documents with XML Schemas
Either before or after transforming X12 EDI content, generated XML Schemas will make sure that we have all of the necessary components, our codes are all according to the standard codelists, and every little delimiter is in the right place.
Xerces - Parsing and Validating XML with the Apache Xerces Parser
The Xerces Parser supports the XML 1.0 recommendation and W3C's XML Schema recommendation version 1.0, DOM and SAX. Learn how easy it is to use Apache Xerces directly in Stylus Studio to parse and validate XML with ease.
Learn XQuery in 10 Minutes, by Dr. Michael Kay - An XQuery Tutorial
Learn XQuery in 10 Minutes By Dr. Michael Kay is for all those people who really want to know what XQuery is, but don't have the time to find out. It's the fastest XQuery tutorial on the planet - read it now!
XML Document Wizards
Stylus Studio XML Document Wizards help you easily convert EDI, flat files, and other document formats to industry-standard XML.

