xsl-list
[Top] [All Lists]

Re: [xsl] possible grouping problem.

2020-10-20 04:17:15
It looks like the resulting CSV-file should simply copy the structure
of the input ids, without any regard to the type of surrounding
elements.


<work_package id="M01">
  <eqpcond>
    <targetfile id="O01"/>
  </eqpcond>
  <eqpcond>
    <targetfile id="O02">
      <targetfile id="O01"/>
      <targetfile id="O03"/>
      <targetfile id="O04">
        <targetfile id="O01"/>
        <targetfile id="O05"/>
        <targetfile id="O06"/>
        <targetfile id="O07"/>
        <targetfile id="O08"/>
        <targetfile id="O09"/>
      </targetfile>
    </targetfile>
  </eqpcond>
  <eqpcond>
    <targetfile id="M02">
      <targetfile id="O01"/>
      <targetfile id="M03">
        <targetfile id="O01"/>
        <targetfile id="M04">
          <targetfile id="O01"/>
          <targetfile id="M05"/>
        </targetfile>
        <targetfile id="M06">
          <targetfile id="O01"/>
        </targetfile>
      </targetfile>
      <targetfile id="M07">
        <targetfile id="O01"/>
        <targetfile id="O02">
          <targetfile id="O01"/>
          <targetfile id="O03"/>
          <targetfile id="O10"/>
        </targetfile>
        <targetfile id="O11">
          <targetfile id="O01"/>
        </targetfile>
      </targetfile>
      <targetfile id="M08">
        <targetfile id="O01"/>
        <targetfile id="O02">
          <targetfile id="O01"/>
          <targetfile id="O03"/>
          <targetfile id="O10"/>
        </targetfile>
      </targetfile>
    </targetfile>
  </eqpcond>
</work_package>

<pre>

M01,O01
M01,O02
M01,   ,O01,O03,O10
M01,   ,   ,O01,O05,O06,O07
M01,M02
M01,   ,O01,M03
M01,   ,   ,O01,M04
M01,   ,   ,   ,O01,M05
M01,   ,   ,M06
M01,   ,   ,   ,O01
M01,   ,M07
M01,   ,   ,O01,O02
M01,   ,   ,   ,O01,O03,O10
M01,   ,   ,O11
M01,   ,   ,   ,O01
M01,   ,M08
M01,   ,   ,O01,O02
M01,   ,   ,   ,O01,O03,O10

</pre>

Best regards

Christoph


Am Di., 20. Okt. 2020 um 10:24 Uhr schrieb Michael Kay 
mike(_at_)saxonica(_dot_)com <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com>:

Spare a thought for your readers! This problem would be so much easier to
understand if you reduced the id's to simple values like M01 and O22, and
if you reduced the number of elements so the XML fits on one screen without
scrolling. You're much more likely to get a response if the problem is
clear without 10 minutes staring at it.

Michael Kay
Saxonica

On 19 Oct 2020, at 22:15, Charlie0 charlieo0(_at_)comcast(_dot_)net <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

Greetings,

I have an issue that I think is a grouping problem but I just can't seem
to figure it out. I have no code to show as I'm that lost on this.

I have the following XML that needs to transform to a comma delimited text
file. See text after the XML. Any assistance to get me in the right
direction is appreciated.

XML:

<work_package id="M2183892350419">
  <eqpcond>
     <targetfile id="O1012492350419"/>
  </eqpcond>
  <eqpcond>
     <targetfile id="O1003092350419">
        <targetfile id="O1012492350419"/>
        <targetfile id="O1000492350419"/>
        <targetfile id="O1002492350419">
           <targetfile id="O1012492350419"/>
           <targetfile id="O1000192350418"/>
           <targetfile id="O1000192350416"/>
           <targetfile id="O1000192350417"/>
           <targetfile id="O1000192350415"/>
           <targetfile id="O1000192350414"/>
        </targetfile>
     </targetfile>
  </eqpcond>
  <eqpcond>
     <targetfile id="M2184292350419">
        <targetfile id="O1012492350419"/>
        <targetfile id="M2171392350419">
           <targetfile id="O1012492350419"/>
           <targetfile id="M2171492350419">
              <targetfile id="O1012492350419"/>
              <targetfile id="M2171292350419"/>
           </targetfile>
           <targetfile id="M2171192350419">
              <targetfile id="O1012492350419"/>
           </targetfile>
        </targetfile>
        <targetfile id="M2183992350419">
           <targetfile id="O1012492350419"/>
           <targetfile id="O1003092350419">
              <targetfile id="O1012492350419"/>
              <targetfile id="O1000492350419"/>
              <targetfile id="O1002492350419"/>
           </targetfile>
           <targetfile id="O1011492350417">
              <targetfile id="O1012492350419"/>
           </targetfile>
        </targetfile>
        <targetfile id="M2007992350419">
           <targetfile id="O1012492350419"/>
           <targetfile id="O1003092350419">
              <targetfile id="O1012492350419"/>
              <targetfile id="O1000492350419"/>
              <targetfile id="O1002492350419"/>
           </targetfile>
        </targetfile>
</targetfile></eqpcond></work_package>

Desired output:

M2183892350419,O1012492350419
M2183892350419,O1003092350419
M2183892350419,,O1012492350419,O1000492350419,O1002492350419

M2183892350419,,,O1012492350419,O1000192350418,O1000192350416,O1000192350417
M2183892350419,M2184292350419
M2183892350419,,O1012492350419,M2171392350419
M2183892350419,,,O1012492350419,M2171492350419
M2183892350419,,,,O1012492350419,M2171292350419
M2183892350419,,,M2171192350419
M2183892350419,,,,O1012492350419
M2183892350419,,M2183992350419
M2183892350419,,,O1012492350419,O1003092350419
M2183892350419,,,,O1012492350419,O1000492350419,O1002492350419
M2183892350419,,,O1011492350417
M2183892350419,,,,O1012492350419
M2183892350419,,M2007992350419
M2183892350419,,,O1012492350419,O1003092350419
M2183892350419,,,,O1012492350419,O1000492350419,O1002492350419

Regards,

CharlieO


XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/2867173> (by
email <>)

--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>