私は XSLT を初めて使用します。XML ファイルがあり、xslt を使用して xml ファイル内の情報をテーブルに表示したいと考えています。しかし、次のように情報を連続して表示できます。
apfel 8.97 Fa. Krause Kirschen 10.45 Fa. Helbig apfel 12.67 Fa. Liebig
これは私のXMLファイルです:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="/First.xsl"?>
<lieferungen xmlns="urn:myspace:lieferungen"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:myspace:lieferungen ....">
<artikel id="3526">
<name>apfel</name>
<preis stueckpreis="true">8.97</preis>
<lieferant>Fa. Krause</lieferant>
</artikel>
<artikel id="7866">
<name>Kirschen</name>
<preis stueckpreis="false">10.45</preis>
<lieferant>Fa. Helbig</lieferant>
</artikel>
</lieferungen>
ここに私のXSLTがあります:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
<xsl:template match="/">
<html>
<h1>The First XSLT in diesem Jahr</h1>
<table>
<tr>
<td>Name</td>
<td>Artikel</td>
<td>Preis</td>
<td>Liferant</td>
</tr>
<xsl:for-each select="artikel">
<tr>
<td>
<xsl:value-of select="name"/>
</td>
<td>
<xsl:value-of select="preis"/>
</td>
<td>
<xsl:value-of select="lieferant"/>
</td>
</tr>
</xsl:for-each>
</table>
</html>
</xsl:template>
</xsl:stylesheet>