xmlの属性の存在に基づいて行のbgcolorを変更します。各属性は、私がやろうとしています何xmlの属性の存在に基づいて行のbgcolorを変更します。各属性はこの行のセルになります
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="abc.xsl"?>
<cars>
<toyota petrol="true" color="red" abs="true" new-feature1="true"/>
<mazda petrol="true" color="red" abs="true" new-feature2="true"/>
</cars>
この行のセルになりますと、私は何をしたいの車
<table>
<tr>toyota</tr>
<tr bgcolor="green">
<td>petrol=true</td>
<td>color=red</td>
<td>abs=true</td>
<td>new-feature1=true</td>
</tr>
<tr>mazda</tr>
<tr bgcolor="green">
<td>petrol=true</td>
<td>color=red</td>
<td>abs=true</td>
<td>new-feature2=true</td>
</tr>
</table>
と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>cars</h2>
<table border="1">
<xsl:for-each select="cars/*">
<tr><xsl:value-of select="name()"/></tr>
<tr>
<xsl:for-each select="@*">
<td><xsl:value-of select="name()"/>=<xsl:value-of select="."/></td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
のテーブルを作ることです"new-feature *"属性が存在する場合は行全体を緑色にし、そうでない場合は行を赤色にすることです
質問を編集して現在のXSLTを表示できますか?ありがとうございました! –
ok ...それは、xmlやxslのどちらも実際の実装ではないことに注意してください。わかりやすくするために、小さなxmlを作成しました。 –