Xslt 计算本地-name()等于“FootNoteReference”的先前元素
如何计算像这样的xml文档中有多少以前的脚注引用节点Xslt 计算本地-name()等于“FootNoteReference”的先前元素,xslt,Xslt,如何计算像这样的xml文档中有多少以前的脚注引用节点 <MyDoc> <title><Big Title></title> <head>Objective</head> <head2><Heading></head2> <head>Introduction</head> <Para> asdf asdf asdf
<MyDoc>
<title><Big Title></title>
<head>Objective</head>
<head2><Heading></head2>
<head>Introduction</head>
<Para>
asdf asdf asdf asd<FootNoteReference />asdf asdf asfd asfd
</Para>
<head>Overview</head>
<Para>
<Begin with a definition of the class to which<FootNoteReference /> the categories belong, if required.>
</Para>
<Para><List the different categories to be taught.></Para>
<Heading1><Category 1></Heading1>
<Para>< som neodolal a celé ozdobené spústou prachu v jednom preso></Para>
<Para><Provide examples, if required.></Para>
<Heading1><Category 2></Heading1>
<Para>< som neodolal a celé ozdobené spústou prachu v jednom preso></Para>
<Para><Provide examples, if required.></Para>
<Heading1><Category 3></Heading1>
<Para>
<Provide a description<FootNoteReference /> of the third category as outlined in the list.>
</Para>
<Para><Provide examples, if required.></Para>
<head>Summary</head>
<ListItem type="ul"><Summarize the definition, if applicable.></ListItem>
<ListItem type="ul">< som neodolal a celé ozdobené spústou prachu v jednom preso<FootNoteReference />.></ListItem>
<ListItem type="ul">< som neodolal a celé ozdobené spústou prachu v jednom preso></ListItem></MyDoc>
注意FootNoteReference节点是如何嵌套在不同级别的。我知道它们是否都嵌套在同一级别,我可以这样做:countprevious sibling::*[local name='FootNoteReference']
谢谢 使用:
count$vNode/previous::FootNoteReference
是$vNode引用的节点之前的脚注引用元素数
如果节点是任何FootNoteReference元素的后代,并且您还希望计算其祖先FootNoteReference元素的数量,则还应考虑FootNoteReference元素在上的出现,这将通过以下XPath表达式完成:
count$vNode/previous::FootNoteReference
|$vNode/祖先::FootNoteReference使用:
count$vNode/previous::FootNoteReference
是$vNode引用的节点之前的脚注引用元素数
如果节点是任何FootNoteReference元素的后代,并且您还希望计算其祖先FootNoteReference元素的数量,则还应考虑FootNoteReference元素在上的出现,这将通过以下XPath表达式完成:
count$vNode/previous::FootNoteReference
|$vNode/祖先::FootNoteReference感谢您的帮助。这就成功了:select=countpreference::footnoteReference感谢帮助。这就成功了:select=countprevious::FootNoteReference