XSL provides two mechanisms for federated style sheets:
1. style sheet import, allowing the style sheet to be referenced to each other
2. Style sheet contains, allows the style sheet to be combined with the original text.
Style sheet Import
An XSL style sheet can contain xsl:import elements. All xsl:import elements must appear at the beginning of the style sheet. The Xsl:import element has an HREF attribute whose value represents the URI of the style sheet to import. A relative URI is a base URI relative to the Xsl:import element.
The rules and definitions in the guided style sheet are more important than the rules and definitions in any of the imported style sheets. Similarly, the rules and definitions in an imported style sheet are more important than the rules and definitions in the style sheet that you imported earlier. In general, More important rules or definitions take precedence over important rules or definitions. The rules and definitions in each category will be specified in detail.
The style sheet contains
You can use the Xsl:include element in one style sheet to contain another XSL style sheet. Xsl:include also has the href attribute, whose value represents the URI of the included style sheet. A relative URI is a base URI relative to the xsl:include element. The Xsl:include element can be a child element of a xsl:stylesheet element, appearing after any xsl:import. The hierarchy of the XML tree should be in effect on the. The resource content positioned by the href attribute value is parsed as an XML document in which the xsl: The stylesheet element replaces the Xsl:include element that contains the document. Also after the Xsl:import element of the contained document is moved up to any existing xsl:import element in the containing document. Unlike Xsl:import, the contained rules or definitions do not affect the way in which they are processed.
Embed style sheet
Typically, a stylesheet is a complete XML document that Xsl:stylesheet elements as elements of a document. However, an XSL stylesheet can also be embedded in other document content. There may be two ways in which an XSL stylesheet can be embedded in a non-XML document or xsl: Stylesheet does not appear as a document element in an XML document. In the second case, there is a possibility that the inline style, which is the document of its own style, is added. XSL has not yet defined a mechanism for it. This is accomplished by using a common way of combining stylesheets with documents, as long as you meet
1. This method allows part of the content to be defined as a style sheet, such as using a fragment identifier URI
2. The method itself can be embedded in the document, such as as a processing instruction. Defining such a way is not within the scope of the XSL.
The following example shows how to combine style sheets and documents with xml:stylesheet processing instructions to implement inline styles. The URI uses a xpointer in the fragment identifier to determine the position of the xsl:stylesheet element.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.