【发布时间】:2012-03-05 05:56:45
【问题描述】:
如何使用应用模板仅选择以特定模式结尾的名称(而非值)元素?假设下面的xml...
<report>
<report_item>
<report_created_on/>
<report_cross_ref/>
<monthly_adj/>
<quarterly_adj/>
<ytd_adj/>
</report_item>
<report_item>
....
</report_item>
</report>
我想在后代元素以“adj”结尾的所有<report_item> 实例上使用<xsl:apply-templates>,因此,在这种情况下,只会选择monthly_adj、quaterly_adj 和ytd_adj 并将其与模板一起应用。
<xsl:template match="report">
<xsl:apply-templates select="report_item/(elements ending with 'adj')"/>
</xsl:template>
【问题讨论】: