1)
<xsl:variable name="pathId" select="Orders/Order[ORD_Num='$id/idNum']"/>
您的意思是: Order
元素至少有一個ORD_Num
子字符串值等於'$id/idNum'
。
替換:
<xsl:variable name="pathId" select="Orders/Order[ORD_Num=$id]"/>
由於$ id變量的字符串值(結果樹片段,你定義)是0607V45621014F
。
注意:如果您將$ id定義爲像select="'0607V45621014F'"
這樣的字符串會更好。此外,您不能(在XSLT 1.0中)執行:[ORD_Num=$id/idNum]
,因爲/
運算符不能應用於RTF。
2)
<xsl:variable name="XmlFile" select="YG.xml"/>
<xsl:value-of select="document($XmlFile)/aziende/azienda/ragione_sociale"/>
在這裏,你說:我們是$ XMLFILE與上下文節點的所有元素YG.xml
孩子的節點集合等
更換(如果你想與相關文檔URI YG.xml
)
<xsl:variable name="XmlFile" select="'YG.xml'"/>
注:因爲document()
是非常通用的(這是少數的人是t,這並不trought錯誤AKE一個object
如PARAM)
3)
<xsl:variable name="tagName" select="aziende"/>
<xsl:value-of select="document($XmlFile)/$tagName/azienda/ragione_sociale"/>
這不起作用,因爲/
右側expresion必須是一個路徑(在XSLT 2.0可以是函數以及)。
替換:
<xsl:variable name="tagName" select="document($XmlFile)/aziende"/>
<xsl:value-of select="$tagName/azienda/ragione_sociale"/>
或者
<xsl:variable name="tagName" select="'aziende'"/>
<xsl:value-of select="document($XmlFile)/*[name()=$tagName]/azienda/ragione_sociale"/>
請重新格式化您的問題。寫一些像「幫幫我!」,「謝謝」等東西會擊退人們回答。使用完整的句子。描述所需的輸入和輸出,例如「我變量x ='ab',y ='c',我想要z ='abc'」。在最後兩個例子中,我無法做出有意義的區別。 – phihag 2010-07-16 15:20:45