第一關你好XSL嵌套每個現在的位置問題
好了我的問題,我試圖建立一種開放源碼的購物車,它使用XML存儲和XSL樣式籃下
1,我的XML
<items>
<item>
<item-name>vlaue</item-name>
<item-number>vlaue</item-number>
<quantity>vlaue<quantity>
<option>
<on0>vlaue</on0>
<os0>vlaue</os0>
<on1>vlaue</on1>
<os1>vlaue</os1>
</option>
</item>
</items>
該XML將一個項目中創建2個選項 由於貝寶允許的7個選項theat一個最大將是我上菲格爾 確定我的XSL
<xsl:for-each select="item">
<input type='hidden' name="item_name_{position()}" value="{item-name}"/>
<input type='hidden' name="item_number_{position()}" value="{item-description}"/>
<input type='hidden' name="amount_{position()}" value="{unit-price}"/>
<input type='hidden' name="quantity_{position()}" value="{@quantity}"/>
<xsl:for-each select="option">
<input type='hidden' name="on{position()}_(i need this to be item postion)" value="(i need this to be "on" with the option postion appened ie "on0")"/>
<input type='hidden' name="os{position()}_{i need this to be item postion}" value="(i need this to be "os" with the option postion appened ie "os0")"/>
</xsl:for-each>
</xsl:for-each>
所以我真的要問我能有現在的位置的值從外每個傳遞到內每個
如果任何人能幫助它會graet
預先感謝您
Tim Dodgson
小的一點,但是您指的是{@quantity},當數量在XML中是一個元素,而不是一個屬性。 – Flynn1179 2010-07-26 12:27:04
@timdodgson:處理輸入樣本時,您希望輸出什麼?我問你這個,因爲每個答案都是保持你的XSLT模板設計,這不是一個好的XSLT風格 – 2010-07-26 15:43:28