Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Same tricks from Re: Get Node Value from irregular XML (xpather.pl)  "//header[ contains(.,'rationale') ]/* "
xmllint.exe --xpath " //header[ contains(.,'rationale') ]/l /preceding +-sibling::* " fudge xmllint.exe --xpath " //header[ contains(.,'rationale') ]/child::text( +) " fudge
where fudge is your data part=1 part=2
<fudge> <root> <part> <sect> <header> 1. Purpose and rationale <p>purpose 1</p> <p>Purpose 2</p> <p>purpose 3</p> <l> <li>purpose list 1</li> <li>list2</li> </l> </header> </sect> </part> </root> <root> <part> <sect> <header> 2. Purpose and rationale <p>2 purpose 1</p> <p>2 Purpose 2</p> <p>2 purpose 3</p> <l> <li>2 purpose list 1</li> <li>2 list2</li> </l> <p>2. Some other heading</p> <p>2 content 1</p> <p>2 content 2</p> </header> </sect> </part> </root> </fudge>

The two queries combined, with the results

xmllint.exe --xpath " //header[ contains(.,'rationale') ]/child::text( +) | //header[ contains(.,'rationale') ] /l/preceding-sibling::* " f +udge 1. Purpose and rationale <p>purpose 1</p> <p>Purpose 2</p> <p>purpose 3</p> 2. Purpose and rationale <p>2 purpose 1</p> <p>2 Purpose 2</p> <p>2 purpose 3</p>

In reply to Re: Having trouble with siblings by Anonymous Monk
in thread Having trouble with siblings by madbee

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others exploiting the Monastery: (9)
    As of 2014-12-18 07:35 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (44 votes), past polls