2013-03-19 50 views
0

簡單的問題,在我的xslt中我想在表格中打印一個屬性的固定值,如果我把它放在一個標籤中,我會得到相同的結果,但是我想做得很好嗎?有人可以告訴我如何? Thnks。
在我doc.xml <unit_price currency="$"> 4.00 </unit_price>如何在xslt的表中顯示屬性?

在我doc.xslt

<table> 
<xsl:for-each select="TotalProducts/products"> 
<tr> 
<td> 
    <xsl:value-of select="unit_price"/> 
    <label> $ </label> 
</td> 
+0

想要在表格中顯示貨幣屬性嗎? – 2013-03-19 13:22:23

+0

@MthetheGGreen是的,請。沒有標籤... – Lindsay 2013-03-19 13:26:06

回答

1

如果你想顯示您的XML屬性你可以使用的@的XPath的選擇。所以你可以改變你的label行到下面。

<xsl:value-of select="unit_price/@currency" />