XSLT <xsl: apply-import> Element
Definicja i Wykorzystanie
<Xsl: apply-import> element może być stosowany od importowanych zasad arkuszu stylów.
Importowanie stylów priorytet reguły szablonu niż główny reguły szablonu arkusza stylów, które mają być niskie. Jeśli chcesz używać do importowania arkusza stylów w regule szablonu artykule, zamiast główny arkusz stylów jest równoważna artykule zasad, będzie korzystał z <xsl: apply-importu> element.
gramatyka
<xsl:apply-imports/>
nieruchomość
nie
Przykłady
Załóżmy, że mamy arkusz stylów o nazwie "standard.xsl", który zawiera przepisy dotyczące elementu szablony wiadomości:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="message">
<h2><xsl:apply-templates/></h2>
</xsl:template>
</xsl:stylesheet>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="message">
<h2><xsl:apply-templates/></h2>
</xsl:template>
</xsl:stylesheet>
Kolejny arkusz stylów do zaimportowania "standard.xsl" i modyfikować elementy wiadomości, co następuje:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="standard.xsl"/>
<xsl:template match="message">
<div style="border:solid blue">
<xsl:apply-imports/>
</div>
</xsl:template>
</xsl:stylesheet>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="standard.xsl"/>
<xsl:template match="message">
<div style="border:solid blue">
<xsl:apply-imports/>
</div>
</xsl:template>
</xsl:stylesheet>
Wyniki położy wiadomość do elementów formy:
<div style="border:solid blue"><h2>...</h2></div>
Kompletna instrukcja XSLT element odniesienia