XSLT <xsl:invoer>
❮ Voltooi XSLT-elementverwysing
Definisie en gebruik
Die <xsl:import>-element is 'n topvlak-element wat gebruik word om die inhoud van een stylblad na 'n ander in te voer.
Let wel: 'n Ingevoerde stylblad het 'n laer voorkeur as die invoerstylblad.
Let wel: Hierdie element moet verskyn as die eerste kind node van <xsl:stylesheet> of <xsl:transform>.
Sintaksis
<xsl:import href="URI"/>
Eienskappe
Attribute | Value | Description |
---|---|---|
href | URI | Required. Specifies the URI of the style sheet to import |
Voorbeeld 1
Gestel jy het 'n stylblad genaamd "cdcatalog_ex3.xsl":
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<h2>My CD Collection</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Title</th>
<th>Artist</th>
</tr>
<tr>
<td><xsl:value-of select="catalog/cd/title"/></td>
<td><xsl:value-of select="catalog/cd/artist"/></td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
'n Tweede stylblad genaamd "cdcatalog_import.xsl" voer "cdcatalog_ex3.xsl" in:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="cdcatalog_ex3.xsl"/>
<xsl:template match="/">
<xsl:apply-imports/>
</xsl:template>
</xsl:stylesheet>
❮ Voltooi XSLT-elementverwysing