| <html x:found="true" x:href="http://www.w3.org/TR/xslt#element-apply-imports" xmlns:x="urn:xslt-documentation" xmlns="http://www.w3.org/1999/xhtml"> |
| <head> |
| |
| <style type="text/css" id="w3c"> |
| a.external { |
| text-decoration: none; |
| border-bottom-color: blue; |
| border-bottom-style: dashed; |
| border-bottom-width: thin; |
| } |
| |
| p.element-syntax { |
| border-color: black; |
| border-style: solid; |
| border-width: thin; |
| } |
| |
| /* 2005-10-03: Modified to work with Java's HTML displaying capabilities */ |
| |
| /* Style for a "Recommendation" (http://www.w3.org/StyleSheets/TR/W3C-REC) */ |
| |
| /* |
| Copyright 1997-2003 W3C (MIT, ERCIM, Keio). All Rights Reserved. |
| The following software licensing rules apply: |
| http://www.w3.org/Consortium/Legal/copyright-software */ |
| |
| body { |
| margin: 0; |
| font-family: sans-serif; |
| color: black; |
| background-position: top left; |
| } |
| |
| :link { |
| color: #00C; |
| background: transparent |
| } |
| |
| :visited { |
| color: #609; |
| background: transparent |
| } |
| |
| a:active { |
| color: #C00; |
| background: transparent |
| } |
| |
| a:link img, a:visited img { |
| border-style: none |
| } |
| |
| /* no border on img links */ |
| |
| a img { |
| color: white; |
| } |
| |
| th, td { |
| /* ns 4 */ |
| font-family: sans-serif; |
| } |
| |
| h1, h2, h3, h4, h5, h6 { |
| text-align: left |
| } |
| |
| /* background should be transparent, but WebTV has a bug */ |
| h1, h2, h3 { |
| color: #005A9C; |
| } |
| |
| h1 { |
| font: 170% sans-serif |
| } |
| |
| h2 { |
| font: 140% sans-serif |
| } |
| |
| h3 { |
| font: 100% sans-serif |
| } |
| |
| h4 { |
| font: bold 100% sans-serif |
| } |
| |
| h5 { |
| font: italic 100% sans-serif |
| } |
| |
| h6 { |
| font: small-caps 100% sans-serif |
| } |
| |
| .hide { |
| display: none |
| } |
| |
| div.head { |
| margin-bottom: 1em |
| } |
| |
| div.head h1 { |
| margin-top: 2em; |
| clear: both |
| } |
| |
| div.head table { |
| margin-left: 2em; |
| margin-top: 2em |
| } |
| |
| p.copyright { |
| margin-top: 15px; |
| font-size: 90% |
| } |
| |
| p.copyright small { |
| font-size: small |
| } |
| |
| /* hide from IE3 */ |
| a[href]:hover { |
| background: #ffa |
| } |
| |
| pre { |
| margin-left: 2em |
| } |
| |
| /* |
| p { |
| margin-top: 0.6em; |
| margin-bottom: 0.6em; |
| } |
| */ |
| dt, dd { |
| margin-top: 0; |
| margin-bottom: 0 |
| } |
| |
| /* opera 3.50 */ |
| dt { |
| font-weight: bold |
| } |
| |
| pre, code { |
| font-family: monospace |
| } |
| |
| /* navigator 4 requires this */ |
| |
| ul.toc { |
| list-style: disc; /* Mac NS has problem with 'none' */ |
| list-style: none; |
| } |
| </style> |
| </head> |
| <body> |
| |
| <h3> |
| <a name="apply-imports"></a>Overriding Template Rules</h3> |
| |
| |
| <p class="element-syntax"> |
| <a name="element-apply-imports"></a><code><!-- |
| Category: instruction --><br> |
| <xsl:apply-imports /></code> |
| </p> |
| |
| |
| <p>A template rule that is being used to override a template rule in an |
| imported stylesheet (see <a class="external" href="http://www.w3.org/TR/xslt#conflict">[<b>5.5 Conflict Resolution for |
| Template Rules</b>]</a>) can use the <code>xsl:apply-imports</code> element |
| to invoke the overridden template rule.</p> |
| |
| |
| <p> |
| <a name="dt-current-template-rule"></a>At any point in the processing of a |
| stylesheet, there is a <b>current template rule</b>. Whenever a template |
| rule is chosen by matching a pattern, the template rule becomes the current |
| template rule for the instantiation of the rule's template. When an |
| <code>xsl:for-each</code> element is instantiated, the current template rule |
| becomes null for the instantiation of the content of the |
| <code>xsl:for-each</code> element.</p> |
| |
| |
| <p> |
| <code>xsl:apply-imports</code> processes the current node using only |
| template rules that were imported into the stylesheet element containing the |
| current template rule; the node is processed in the current template rule's |
| mode. It is an error if <code>xsl:apply-imports</code> is instantiated when |
| the current template rule is null.</p> |
| |
| |
| <p>For example, suppose the stylesheet <code>doc.xsl</code> contains a |
| template rule for <code>example</code> elements:</p> |
| |
| <pre><xsl:template match="example"> |
| <pre><xsl:apply-templates/></pre> |
| </xsl:template></pre> |
| |
| |
| <p>Another stylesheet could import <code>doc.xsl</code> and modify the |
| treatment of <code>example</code> elements as follows:</p> |
| |
| <pre><xsl:import href="doc.xsl"/> |
| |
| <xsl:template match="example"> |
| <div style="border: solid red"> |
| <xsl:apply-imports/> |
| </div> |
| </xsl:template></pre> |
| |
| |
| <p>The combined effect would be to transform an <code>example</code> into an |
| element of the form:</p> |
| |
| <pre><div style="border: solid red"><pre>...</pre></div></pre> |
| |
| <p id="w3c-footer" class="copyright"> |
| <a href="http://www.w3.org/Consortium/Legal/ipr-notice.html#Copyright">Copyright</a> |
| © 1999 <a href="http://www.w3.org">W3C</a><sup>®</sup> |
| (<a href="http://www.lcs.mit.edu">MIT</a>, <a href="http://www.inria.fr/">INRIA</a>, |
| <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. |
| </p> |
| </body> |
| </html> |