我加載符合XML在變XSL Filter屬性和名稱()
<files>
<documents lang="en">
<Invoice>22345</Invoice>
<Invoice>22346</Invoice>
<Offer>22345</Offer>
<Offer>22346</Offer>
</documents>
<documents lang="de">
<Invoice>92345</Invoice>
<Invoice>92346</Invoice>
<Offer>92345</Offer>
<Offer>92346</Offer>
</documents>
</files>
一個XSL現在我喜歡和屬性LANG =「de」表示,所有的發票內容過濾的文件。
<xsl:variable name="documents" select="document('documents.xml')/files/documents" />
<xsl:variable name="documentName" select="'Invoice'" />
<xsl:apply-templates
mode="filter"
select="$documents[@lang='de' and name() = $documentName]"/>
<xsl:template mode="filter" match="entrys[@lang] | *">
<xsl:value-of select="."/>
</xsl:template>
當然
不工作是應該是這樣的
<xsl:apply-templates
mode="filter"
select="$documents[@lang='de' and */name() = $documentName]"/>
但是這給我一個語法錯誤。
所以,有人可以幫助我一個想法。
編輯 之前'發票'被硬編碼在過濾器中。
我補充說,
在此先感謝。
T.S
' 「發票」 單曲/ b''Invoice'' –
謝謝,我已經編輯了這個,但仍然有問題。 – Thaispookie