试图标记无线电输入作为与XSLT使用下面的XSLT代码1.0选择但这并不产生所期望的结果XSLT属性不被添加
desrired结果
<input type="radio" value="available" title="email" selected="selected" />
实际输出
<input type="radio" value="available" title="email" selected />
任何任何想法为什么不请你?
XSLT
<xsl:variable name="selected">selected</xsl:variable>
<xsl:for-each select="item">
<tr>
<td><xsl:value-of select="title" /></td>
<td>
<input type="radio" value="available" >
<xsl:attribute name="name">
<xsl:value-of select="title" />
</xsl:attribute>
<xsl:if test="category='available'">
<xsl:attribute name="selected">
<xsl:value-of select="$selected"/>
</xsl:attribute>
</xsl:if>
</input>
</td>
<td>
<input type="radio" value="unavailable" >
<xsl:attribute name="name">
<xsl:value-of select="title" />
</xsl:attribute>
<xsl:if test="category='unavailable'">
<xsl:attribute name="selected">
<xsl:value-of select="$selected"/>
</xsl:attribute>
</xsl:if>
</input>
</td>
<td>
<input type="radio" value="warning" >
<xsl:if test="category='warning'">
<xsl:attribute name="selected">
<xsl:value-of select="$selected"/>
</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select="title" />
</xsl:attribute>
</xsl:if>
</input>
</td>
</tr>
</xsl:for-each>
感谢非常很多,就是这样。也意识到我应该使用检查=“检查” – 2010-03-29 08:49:00
啊,是的,这个错误可以很容易地跳过XSLT奥尔卡纳;-) - 好抓! (您可以使用HTML验证器来捕捉那种错误 - 应该可能检测到没有意义的属性。) – 2010-03-29 18:04:19