See below for contents of a template --> </xsl:template> See also named templates. XSLT <xsl:template> Element. The <xsl:template> element contains rules to apply when a specified node is matched. The match pattern for the template. Defining Match Patterns in The match attribute on the < xsl: template> element contains a pattern expression. The syntax is the same as that used to select nodes with < xsl: for- each> , < xsl: value- of> , and < xsl: apply- templates> elements. However, the pattern is used in quite a different way. In a select pattern, the pattern describes a query down from a particular node to locate a new set of nodes. XSLT <xsl:template> Element Previous Next. The <xsl:template> element defines a template. The match='/' attribute associates the template with the root of the XML source document. The content inside the <xsl. XSLT (Extensible Stylesheet Language Transformations) is a language for transforming XML documents into other XML documents, or other formats such as HTML for web pages, plain text or XSL Formatting Objects, which may. Is my > assessment of the first two correct? Gutch - Fri, 08:11:46 -0500 David Carlisle. For XSL Templates the match pattern is the same as that of other XSL patterns such as for-each. Description The match attribute is required except when you specify the name attribute. The pattern you specify for the match attribute identifies the source node or set of source nodes to which the template rule applies. A match pattern is quite different. The match pattern does not locate anything new, but rather compares a specific node against a pattern to see if the node matches that pattern, and thus whether or not to use a particular template. Here are some of the differences between the use of match patterns and select patterns. Select pattern. Match pattern. Starts with a node (the context), and identifies more nodes. Starts with a node (the target), and yields a true/false (match/didn't match) result. Starts at the context and drills down into the data. Starts by testing the node against the node target, and then checks the context, including ancestry and descendants. Represents a query into an XML document. Represents a pattern of contextual information against which a particular node can be tested. Match patterns are quite similar to selectors in cascading style sheets (CSS). The simplest match pattern is just a single element name, such as . If a text node matches the . If a < section> element matches the . Any < title> elements that are not within a < section> (for example, the document title) do not match this pattern, and a separate template must be defined (such as . The target of the pattern (the term farthest to the right) represents the node to be tested. This is similar to a select pattern in which the target represents the nodes to select. The following table lists some match patterns and their meanings. Pattern. Meaning when used as a match pattern. The section must also have a type attribute with the value . These < section> elements, in turn, must have both a type attribute with the value . For example: < xsl: templatematch=. Which template will be selected? The rule is as follows: Templates later in the style sheet override earlier templates. To ensure that the XSLT processor checks the . Most of the templates in this sample are mutually exclusive, so their order is unimportant.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2016
Categories |