xquery - Help with XPath query (count) -


I want to count all the descent or nodes of a certain node, but only all the lineages which are definitely below level 0 Starting with Do you have any suggestions?

Actually something looks like:

  count (// fstructure / node ()) + count (// fstructure / node () / node ()) + Count (// floor / node () / node () / node ()) + 1   

works for 3 levels and (element) node "foundation", even if it Not really good, but I need it for debugging only.

Best regards, Johannes

this XPath expression

  count (ExprForYourNode // * [no (calculation (ancestor :: *) & gt; / Pre> 

Select all the elements selected by the expression - Code> Exporter ornode 2 (zero-based) with maximum depth

If you want to select all the anti - or self nodes (elements, text nodes, comment-nodes And processing-instructions-node) :

  count (ExprForYourNode // node (not (count (ancestor :: *)> this document For example :  
  & lt; count (ExprForYourNode / ancestor :: *) + 2))   

T & Gt; & lt; a & gt; & lt; p & gt; & lt; c & gt; & lt; d / & gt; & lt; / c & gt; & lt; / p & gt; & lt ; / A & gt; & lt; / t & gt;

This expression :

  count (/ * / A // * [no (count (ancestor :: *) & Gt; Count  (<*   

This is the number of elements ( b and c , but not d ) which are descended from < a 2 or less with a depth related to Code> a . Similarly, evaluation of this expression :

  count (/ * / a // node (not (count (counting (ancestor: :  

: This number of elements (as before) is plus (white-space-only) number of text nodes in depth in element 2 a

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -