0
我無法將我的XML數據存入XSLT。我使用literal return
函數。xslt將xml值輸入到輸入文本框中
這裏是我的XML:
<userproperties userid="82131">
<following>1</following>
<liked>1</liked>
</userproperties>
這裏是我在獲取XML數據轉換成這些值
<input type="hidden" id="currentlikedval" value="{//return/*/userproperties/liked}"/>
<input type="hidden" id="currentfollowingval" value="{//return/*/userproperties/following}"/>
我的第二次嘗試企圖:
<input type="hidden" id="currentlikedval" value="{//return/userproperties/liked}"/>
<input type="hidden" id="currentfollowingval" value="{//return/userproperties/following}"/>
這是由此產生的html:
<input type="hidden" id="currentlikedval" value=""><input type="hidden" id="currentfollowingval" value="">
謝謝。我認爲return這個詞意味着一個文字功能。它似乎只是一個XML路徑的例子 – jkushner
@jkushner我不知道你是什麼意思的「文字功能」。在XPath 2.0的[for expression](http://www.w3.org/TR/xpath20/#doc-xpath-ForExpr)中,「return」一詞具有特殊含義。當以所示的方式使用它時,作爲位置步驟,樣式表將查找名爲「return」的元素。 –