我有一个像这样的XML文件:
<?xml version="1.0" encoding="UTF-8"?>
<doc>
<Pizza Id="2" Type="P">
<Flour Value="type A" Id="17" />
<Tomato Value="cherry" Id="30" />
<Cheese Value="swisscheese" Id="30" />
</Pizza>
<Pasta Id="3" Type="P">
<Wheat Value="buckwheat" Id="16" />
<Water Value="uuuuuuu" Id="14" />
</Pasta>
<Cake Id="27" Type="CP">
<Flour Value="type B" Id="12" />
<Chocolate Value="black" Id="28" />
<Sugar Value="brown" Id="22" />
<Milk Value="fatfree" Id="15" />
</Cake>
<Pie Id="4" Type="P">
<Flour Value="type A" Id="12" />
<Mushroom Value="xxxx" Id="15" />
</Pie>
<Pie Id="5" Type="X">
<Steak Value="beef" Id="12" />
<Mushroom Value="xxxx" Id="15" />
</Pie>
</doc>
我正在寻找一个提供如下输出的转换: 面粉
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:strip-space elements="*"/>
<xsl:template match="doc">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
<xsl:template match="doc/[@Type='P']|doc/[@Type='CP']">
<xsl:for-each select="*">
<xsl:if test="Flour">
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>