我加载符合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