How to Import Document Trees using XSLXSLT provides ways to import document trees from sources outside the document you create for output. This has the effect of creating a modular architecture. Using two elements to drive this process, the xsl : import element and the xsl: include element, you can create one main style sheet that consists of several others.
The xsl : import element imports other style sheets into your style sheet document. When you import a style sheet, you add all the nodes and content of that style sheet to the imported style sheet document. The xsl: import element defines the value for the elements required href attribute. The value of the href attribute consists of a URI where the imported style sheet is located. If the style sheet being imported is being referenced through a relative URI, the base URI is always the importing style sheet: If you’re wondering which elements take precedence in this scenario the rule is pretty simple. The elements in the style sheet containing the link to the imported style sheet take precedence over the elements in the imported style sheet. Using the xsl:apply-imports elements The xsl:apply-imported elements is similar to the xsl:apply-templeates elements. The difference is that xsl: apply-imports is used to apply an imported style sheet to a template. The rules for imported style sheets dictate that the oldest style sheet always takes precedence. You might have a style sheet with an imported style sheet, which in turn may have an imported style sheet, which in turn may have an imported style sheet of its own. Using the xsl:include Element This element works the same way as the xsl:import element, except that the elements included within the included document replace the xsl:include element. Again, the only attribute is a href whose Value is a URI. Consider an included document that look like this: <xsl:include href= “myStylesheet_1.xsl”/> The preceding line of the code becomes:
|
|
||
|
|||
“Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.”
Copyright - © 2004 - 2019 - All Rights Reserved.