[xsl] Re: cleanup of <div>-elements

Subject: [xsl] Re: cleanup of <div>-elements
From: "Chris Papademetrious christopher.papademetrious@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 27 Feb 2023 16:39:17 -0000
Hi Monika,

Will the content between headings always be limited to known "block-level"
element types (p, ol, ul, etc.)?


  *   Chris

From: Madlik, Monika (LNG-VIE) monika.madlik@xxxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, February 27, 2023 11:31 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] cleanup of <div>-elements

Hi,

I have a problem with an XML-file that has to be converted.

I get XML-files that are semi-structured. So I have the h1/h2-information in
it and also tables, lists, ...
Paragraphs are tagged with <p> - but not always. Sometimes <p> is missing and
instead of it a weird construct of <div>-elements is tagged around texts and
other elements.

Is there a possibility to unravel this div-constructs without loosing texts
and structure? I need to have the element <p> around texts and markup for i.e.
strong text or italic text, ...

My problem is, that the div-elements could appear in any form and any depth
and it's also possible that many div-elements are wrapped around other
div-elements.

Example-XML:
<root>
              <h1>...</h1>
              <p>...</p>
              <ul>
                            <li>...</li>
                            <li>...</li>
              </ul>
              <div>
                            <h1>...</h1>
                            <h2>...</h2>
                            <p>...</p>
                            <h2>...</h2>
                            <p>...</p>
                            <h1>...</h1>
                            <p>...</p>
                            <h2>...</h2>
                            <p>...</p>
                            <div>
                                          <h1>...</h1>
                                          <div>...<sup><a href="#footnote-9"
id="9" rel="footnote">[9]</a></sup></div>
                            </div>
                            <div>
                                          <br/> ... <strong>...</strong>
...<sup><a href="#footnote-10" id="10" rel="footnote">[10]</a></sup>
                                          <div>
                                                         <h1>...</h1>
                                          </div>
                            </div>
                            <p>...</p>
              </div>
</root>

The yellow marked text should look like this after my transformation:
<h1>...</h1>
<p>...<sup><a href="#footnote-9" id="9" rel="footnote">[9]</a></sup></p>
<p><br/> ... <strong>...</strong> ...<sup><a href="#footnote-10" id="10"
rel="footnote">[10]</a></sup></p>
<h1>...</h1>


Thanks a lot,
Monika

XSL-List info and
archive<https://urldefense.com/v3/__http:/www.mulberrytech.com/xsl/xsl-list__
;!!A4F2R9G_pg!f1gr0_ZMDVVg5f0HueHWUmEtGAy0Ib1jVOTHPev3cS_JRsYAj2KVqqaBRy6Tcod
gbJbSsUHr5NtB3jPhiTW1C69-eZ_Z3clJqtBFEHmwEpy76u2UInUL$>
EasyUnsubscribe<https://urldefense.com/v3/__http:/lists.mulberrytech.com/unsu
b/xsl-list/3380743__;!!A4F2R9G_pg!f1gr0_ZMDVVg5f0HueHWUmEtGAy0Ib1jVOTHPev3cS_
JRsYAj2KVqqaBRy6TcodgbJbSsUHr5NtB3jPhiTW1C69-eZ_Z3clJqtBFEHmwEpy76gLiPaVt$>
(by email<>)

Current Thread