xpath - Get text but exclude node if it has a certain child in a for-each loop in XSLT? -


I am trying to get the following text

  divided into: bonaire, sint ESTATIUS AND SABA (BQ, BES, 535) KURASAO (CW, CEW, 531) Sint Maarten (Dutch part) (SX, SXM, 534)  

Out of this source (fraction):

  & lt; Td> Divided into: & lt; Br / & gt; & Lt; A href = "/ wiki / Caribbean_Netherlands" title = "Caribbean Netherlands" & gt; Bonaire, Sint Eustatius and Saba & lt; / A & gt; ( BQ ,  BES ,  535  and  ;) & Lt; Sup id = "cite_ref-7" class = "reference" & gt; & Lt; A href = "# cite_note-7" & gt; & Lt; Span & gt; [& Lt; / Span & gt; Note 4 & lt; Period & gt;] & lt; / Span & gt; & Lt; / A & gt; & Lt; / Sup> & Lt; Br / & gt; & Lt; A href = "/ wiki / Cura% C3% A7ao" title = "Curacao" & gt; Curacao & lt; / A & gt; (& Lt; tt> cw , & lt; tt & gt; CYW & lt; / tt>, & lt; tt & lt; 531 & lt; / tt & gt;) & lt ; Br / & gt; & Lt; A href = "/ wiki / Sint_Maarten" title = "Sint Maarten" & gt; Sint Maarten (Dutch part) & lt; / A & gt; (,  SXM ,  534 ) & lt ; / Td>   

It is easily & lt; Xsl: value select = "td [4]" /> (this is the fourth td element, and I

but I want to exclude the text [note 4] So, every a has span children.

I tried td [4] / node () [no (descendant) : Span)] , but it is divided into : . td [4] [no (// span)] always returns empty string.

when you td [4] / node () [no (descendant / period)] , then you Further TD is matching, which does not have a span lineage since your TD is a span dynasty in [4], you are getting empty results

What you need is TD [4] descendants There is a template matching node that outputs text:

  & lt; xsl: template match = "td [4] / node ()" & gt; ... & lt ; Xsl: template & gt; & lt;! - TD's lineage lineage node [4] - & gt;  

and another template specifically catching the span node:

  & lt; Xsl: template match = "span | text [] [predecessor-cybling :: period] | text () [following-brother :: period]" />  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

lua - HowTo create a fuel bar -