XSLT-Transformation
Beispieldatei aus http://de.selfhtml.org/xml/darstellung/xsltelemente.htm ...
XML-Dokument :
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="apply_imports1.xsl" ?>
<test>
<bild>pinguin.gif</bild>
<text>Der Pinguin ist das Wahrzeichen von Linux</text>
</test>
Beispieldatei apply_imports1.xsl:
<?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="apply_imports2.xsl" />
<xsl:template match="/">
<html>
<head>
</head>
<body>
<xsl:apply-imports/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Beispieldatei apply_imports2.xsl:
<?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="bild">
<img><xsl:attribute name="src"><xsl:value-of select="."
/></xsl:attribute></img>
</xsl:template>
<xsl:template match="text">
<p><xsl:value-of select="." /></p>
</xsl:template>
</xsl:stylesheet>