我想选择属性的特定部分并将其分配给变量。
输入:
<p anepane="swedd" conref="../../go_ref/Disti_didin#Disti_didin/k_irl_oi_2222"/>
输入中有很多<p>
。因为所有<p>
的最后一部分都以p_frm
开头。因此,我希望通用模板从p_frm_l1_los_246
中选择@conref
并分配给变量。
尝试的代码:
<xsl:template match="p[@conref]">
<xsl:variable name="aaa" select="self:p"/>
</xsl:template>
以上尝试的代码无法正常工作。帮我解决这个问题。
答案 0 :(得分:1)
尝试这种方法:
<xsl:template match="p[substring-after(substring-after(@conref,'#'),'/') = 'p_frm_l1_los_246']">
<xsl:variable name="aaa" select="@conref"/>
</xsl:template>
它选择p/@conref
以p_frm_l1_los_246
结尾的整个值。
../../ page_references / where_used_breadcrumbs.dita#where_used_breadcrumbs / p_frm_l1_los_246