Data-Edit-Xml-Xref v20200424 Perl 5 v5.31.10 x86_64-linux-ld

Status
Pass
From
Andreas J. König (ANDK)
Dist
Data-Edit-Xml-Xref v20200424
Platform
Perl 5 v5.31.10 x86_64-linux-ld
Date
2020-04-24 01:08:15
ID
134c8af4-85c8-11ea-8be0-365cd522ac9d
This distribution has been tested as part of the CPAN Testers
project, supporting the Perl programming language.  See
http://wiki.cpantesters.org/ for more information or email
questions to cpan-testers-discuss@perl.org


--
Dear Philip R Brenan,

This is a computer-generated report for Data-Edit-Xml-Xref-20200424
on perl 5.31.10, created by CPAN-Reporter-1.2018.

Thank you for uploading your work to CPAN.  Congratulations!
All tests were successful.

Sections of this report:

    * Tester comments
    * Program output
    * Prerequisites
    * Environment and other context

------------------------------
TESTER COMMENTS
------------------------------

Additional comments from tester:

this report is from an automated smoke testing program
and was not reviewed by a human for accuracy

------------------------------
PROGRAM OUTPUT
------------------------------

Output from './Build test':

01:05:50 Tests started                                                           at (eval 113) line 20
01:05:50 Test 001                                                                at (eval 113) line 1080
01:05:53 Xref: 104 refs, 21 image refs, 14 first lines, 14 second lines, 8 duplicate ids, 4 duplicate topic ids, 4 invalid guid hrefs, 2 duplicate files, 2 tables, 1 External xrefs with no format=html, 1 External xrefs with no scope=external, 1 file failed to parse, 1 href missing                                        at lib/Data/Edit/Xml/Xref.pm line 400
01:05:56 Xref: 103 refs, 21 image refs, 14 first lines, 14 second lines, 8 duplicate ids, 4 duplicate topic ids, 4 invalid guid hrefs, 2 duplicate files, 2 tables, 1 External xrefs with no format=html, 1 External xrefs with no scope=external, 1 file failed to parse, 1 href missing                                        at lib/Data/Edit/Xml/Xref.pm line 400
01:05:56 Test 002                                                                at (eval 113) line 1112
01:05:59 Xref: 88 refs, 18 image refs, 14 first lines, 14 second lines, 8 duplicate ids, 4 duplicate topic ids, 4 invalid guid hrefs, 2 duplicate files, 2 tables, 1 External xrefs with no format=html, 1 External xrefs with no scope=external, 1 file failed to parse, 1 href missing                                         at lib/Data/Edit/Xml/Xref.pm line 400
01:05:59 Test 003                                                                at (eval 113) line 1174
01:06:03 Xref: 97 refs, 20 image refs, 14 first lines, 14 second lines, 8 duplicate ids, 4 duplicate topic ids, 4 invalid guid hrefs, 2 duplicate files, 2 tables, 1 External xrefs with no format=html, 1 External xrefs with no scope=external, 1 file failed to parse, 1 href missing                                         at lib/Data/Edit/Xml/Xref.pm line 400
01:06:03 Test 004                                                                at (eval 113) line 1191
01:06:06 Xref: 97 refs, 20 image refs, 14 first lines, 14 second lines, 8 duplicate ids, 4 duplicate topic ids, 4 invalid guid hrefs, 2 duplicate files, 2 tables, 1 External xrefs with no format=html, 1 External xrefs with no scope=external, 1 file failed to parse, 1 href missing                                         at lib/Data/Edit/Xml/Xref.pm line 400
01:06:06 Test 005 - Add Navtitles                                                at (eval 113) line 1242
01:06:09 Xref: 88 refs, 18 image refs, 14 first lines, 14 second lines, 8 duplicate ids, 4 duplicate topic ids, 4 invalid guid hrefs, 2 duplicate files, 2 tables, 1 External xrefs with no format=html, 1 External xrefs with no scope=external, 1 file failed to parse, 1 href missing                                         at lib/Data/Edit/Xml/Xref.pm line 400
01:06:12 Xref: 98 refs, 20 image refs, 14 first lines, 14 second lines, 8 duplicate ids, 4 duplicate topic ids, 4 invalid guid hrefs, 2 duplicate files, 2 tables, 1 External xrefs with no format=html, 1 External xrefs with no scope=external, 1 file failed to parse, 1 href missing                                         at lib/Data/Edit/Xml/Xref.pm line 400
01:06:12 Test 007                                                                at (eval 113) line 1339
01:06:14 Xref: 2 refs, 2 second lines                                            at lib/Data/Edit/Xml/Xref.pm line 400
01:06:14 Test 009                                                                at (eval 113) line 1388
01:06:15 Xref: processed 2 files, found no errors                                at lib/Data/Edit/Xml/Xref.pm line 400
01:06:17 Xref: processed 2 files, found no errors                                at lib/Data/Edit/Xml/Xref.pm line 400
01:06:17 Test 010                                                                at (eval 113) line 1424
Failed to write to file:
/tmp/iGnrehoRXQ/report/timing/xref_phases.txt
 at /tmp/loop_over_bdir-31753-iDm7aS/Data-Table-Text-20200418-0/blib/lib/Data/Table/Text.pm line 978.
	Data::Table::Text::overWriteFile("/tmp/iGnrehoRXQ/report/timing/xref_phases.txt", "Processing phases elapsed times in descending order\x{a}\x{a}Xref pha"...) called at /tmp/loop_over_bdir-31753-iDm7aS/Data-Table-Text-20200418-0/blib/lib/Data/Table/Text.pm line 2690
	Data::Table::Text::formatTable(ARRAY(0x55b37f9a6330), "columns", "Phase         Xref processing phase\x{a}Time_Seconds  Time in sec"..., "head", "Xref phases took the following times on DDDD\x{a}\x{a}Total run time:"..., "title", "Processing phases elapsed times in descending order", "file", ...) called at /tmp/loop_over_bdir-31753-iDm7aS/Data-Table-Text-20200418-0/blib/lib/Data/Table/Text.pm line 2957
	Data::Table::Text::formatHtmlAndTextTables("/tmp/iGnrehoRXQ/report/", undef, "/cgi-bin/uiSelfServiceXref/client.pl?getFile=", "/tmp/iGnrehoRXQ/outFixed/", ARRAY(0x55b37f9a6330), "head", "Xref phases took the following times on DDDD\x{a}\x{a}Total run time:"..., "file", ...) called at lib/Data/Edit/Xml/Xref.pm line 559
	Data::Edit::Xml::Xref::formatTables(Data::Edit::Xml::Xref=HASH(0x55b37f9ad400), ARRAY(0x55b37f9a6330), "columns", "Phase         Xref processing phase\x{a}Time_Seconds  Time in sec"..., "title", "Processing phases elapsed times in descending order", "head", "Xref phases took the following times on DDDD\x{a}\x{a}Total run time:"..., ...) called at lib/Data/Edit/Xml/Xref.pm line 334
	Data::Edit::Xml::Xref::xref2("inputFolder", "/tmp/iGnrehoRXQ/outFixed/", "reports", "/tmp/iGnrehoRXQ/report/") called at lib/Data/Edit/Xml/Xref.pm line 432
	Data::Edit::Xml::Xref::__ANON__ called at /tmp/loop_over_bdir-31753-iDm7aS/Data-Table-Text-20200418-0/blib/lib/Data/Table/Text.pm line 5424
	Data::Table::Text::callSubInParallel(CODE(0x55b37f9e35b8)) called at lib/Data/Edit/Xml/Xref.pm line 432
	Data::Edit::Xml::Xref::xref("inputFolder", "/tmp/iGnrehoRXQ/outFixed/", "reports", "/tmp/iGnrehoRXQ/report/") called at (eval 113) line 1419
	eval 'use Test::More;
use warnings FATAL=>qw(all);

use strict;

if ($^O !~ m(bsd|linux)i)
 {plan skip_all => \'Not supported\';
 }

Test::More->builder->output("/dev/null")                                        # Show only errors during testing
  if ((caller(1))[0]//\'Data::Edit::Xml::Xref\') eq "Data::Edit::Xml::Xref";

makeDieConfess;

my $conceptHeader = <<END =~ s(\\s*\\Z) ()gsr;                                    # Header for a concept
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Task//EN" "concept.dtd" []>
END

mmm "Tests started";

my $testsFolder = temporaryFolder;                                              # Tests folder

#goto latestTest;

sub tests       {$testsFolder}
sub in          {fpd tests, q(in)}                                              # Input folder
sub out         {fpd tests, q(out)}                                             # Output folder
sub outFixed    {fpd tests, q(outFixed)}                                        # Fixed output folder
sub reportFolder{fpd tests, q(report)}                                          # Reports folder
sub targets     {fpf tests, q(targets)}                                         # Tests targets folder

#D1 Create test data                                                            # Create files to test the various capabilities provided by Xref

sub createSampleInputFilesBaseCase($$)                                          #P Create sample input files for testing. The attribute B<inputFolder> supplies the name of the folder in which to create the sample files.
 {my ($in, $N) = @_;                                                            # Input folder, number of sample files
  clearFolder($in, 1e2);
  for my $n(1..$N)
   {my $o = $n + 1; $o -= $N if $o > $N;
    my $f = owf(fpe($in, $n, q(dita)), <<END);
<concept id="c$n" xtrf="$n.dita">
  <title>Concept $n refers to $o</title>
  <conbody id="b$n">
     <xref id="x$n"  format="dita" href="$o.dita#c$o/x$o">Good</xref>
     <xref id="x$n"  format="dita" href="$o.dita#c$n/x$o">Duplicate id</xref>
     <xref id="b1$n" format="dita" href="bad$o.dita#c$o/x$o">Bad file</xref>
     <xref id="b2$n" format="dita" href="$o.dita#c$n/x$o">Bad topic id</xref>
     <xref id="b3$n" format="dita" href="$o.dita#c$o/x$n">Bad id in topic</xref>
     <xref id="g1$n" format="dita" href="$o.dita#c$o">Good 1</xref>
     <xref id="g2$n" format="dita" href="#c$o/x$o">Good 2</xref>
     <xref id="g3$n" format="dita" href="#c$o">Good 3</xref>
     <p conref="#c$n">Good conref</p>
     <p conref="#b$n">Bad conref</p>
     <image href="a$n.png"/>
     <image href="b$n.png"/>
     <ol><li/><li/></ol>
  </conbody>
</concept>
END
   }

  owf(fpe($in, qw(act1 dita)), <<END);
<concept id="guid-000">
  <title id="title">All Timing Codes Begin Here</title>
  <author>Phil</author>
  <conbody>
    <p>Note: see below</p>
    <p>Important: ignore all notes above</p>
    <image href="guid-000"/>
    <image href="guid-act1"/>
    <image href="guid-9999"/>
    <image href="act1.png"/>
    <xref/>
     <ol><li/><li/></ol>
     <ol><li/><li/></ol>
  </conbody>
</concept>
END

  owf(fpe($in, qw(act2 dita)), <<END);
$conceptHeader
<concept id="c2">
  <title id="title">Jumping Through Hops</title>
  <conbody>
    <section>
      <title/>
      <xref  format="dita" href="act1.dita#c1/title">All Timing Codes Begin Here</xref>
      <note  conref="act2.dita#c2/title"/>
      <xref  format="dita" href="9999#c1/title"/>
      <xref  format="dita" href="guid-000#guid-000/title"/>
      <xref  format="dita" href="guid-001#guid-001/title guid-000#guid-000/title"/>
      <xref  format="dita" href="guid-000#guid-000/title2"/>
      <xref  format="dita" href="guid-000#c1/title2"/>
      <xref  format="dita" href="guid-999#c1/title2"/>
      <xref  href="http://"/>
      <image href="act2.png"/>
      <link href="guid-000"/>
      <link href="guid-999"/>
      <link href="act1.dita"/>
      <link href="act9999.dita"/>
      <p conref="9999.dita"/>
      <p conref="bookmap.ditamap"/>
      <p conref="bookmap2.ditamap"/>
    </section>
    <required-cleanup>PLEX18</required-cleanup>
  </conbody>
</concept>
<!--linted: 2018-Nov-23 -->
END

  owf(fpe($in, qw(act3 dita)), <<END);
<concept id="c3">
  <title>Jumping Through Hops</title>
  <conbody>
    <p/>
  </body>
</concept>
END

  owf(fpe($in, qw(act4 dita)), <<END);
<concept id="c4">
  <taskbody/>
</concept>
END

  owf(fpe($in, qw(act5 dita)), <<END);
<concept id="c5">
  <taskbody/>
</concept>
END

  owf(fpe($in, qw(table dita)), <<END);
$conceptHeader
<concept id="table">
  <title>Tables</title>
  <conbody>
    <image href="new pass.png"/>
    <table>
      <tgroup cols="1">
        <thead>
          <row>
            <entry>
              <p>Significant Event</p>
            </entry>
            <entry>
              <p>Audit Event</p>
            </entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry/>
          </row>
        </tbody>
      </tgroup>
    </table>
    <table>
      <tgroup cols="1">
        <colspec/>
        <colspec/>
        <thead>
          <row>
            <entry>aaaa</entry>
            <entry>bbbb</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>aaaa</entry>
            <entry>bbbb</entry>
          </row>
          <row>
            <entry>aaaa</entry>
            <entry>bbbb</entry>
          </row>
        </tbody>
      </tgroup>
    </table>
  </conbody>
</concept>
END

  owf(fpe($in, qw(map bookmap ditamap)), <<END);
<map id="m1">
  <title>Test</title>
  <chapter  href="yyyy.dita">
    <topicref href="../act1.dita">Interesting topic</topicref>
    <topicref href="../act2.dita"/>
    <topicref href="../map/r.txt"/>
    <topicref href="9999.dita"/>
    <topicref href="bbb.txt"/>
    <topicref href="guid-000"/>
    <topicref href="guid-888"/>
    <topicref href="guid-999"/>
  </chapter>
</map>
END
  owf(fpe($in, qw(map bookmap2 ditamap)), <<END);
<map id="m2">
  <title>Test 2</title>
  <chapter  href="zzzz.dita">
    <topicref href="../act1.dita">Interesting topic</topicref>
    <topicref href="../act2.dita"/>
    <topicref href="../map/r.txt"/>
    <topicref href="9999.dita"/>
    <topicref href="bbb.txt"/>
    <topicref href="guid-000"/>
    <topicref href="guid-888"/>
    <topicref href="guid-999"/>
  </chapter>
</map>
END
  owf(fpe($in, qw(map bookmap3 ditamap)), <<END);
<map id="m2">
  <title>Test 3</title>
  <chapter  href="../act3.dita"/>
  <chapter  href="../act4.dita"/>
  <chapter  href="../act5.dita"/>
</map>
END
  createEmptyFile(fpe($in, qw(a1 png)));
 }

sub createSampleInputFilesFixFolder($)                                          #P Create sample input files for testing fixFolder
 {my ($in) = @_;                                                                # Folder to create the files in
  owf(fpe($in, 1, q(dita)), <<END);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE reference PUBLIC "-//PHIL//DTD DITA Task//EN" "concept.dtd" []>
<concept id="c1">
  <title>Concept 1 which refers to concept 2</title>
  <conbody>
     <p conref="2.dita#c2/p1"/>
     <p conref="2.dita#c2/p2"/>
     <p conref="3.dita#c2/p1"/>
     <xref href="2.dita#c2/p1"/>
     <xref href="2.dita#c2/p2"/>
     <xref href="3.dita#c2/p1"/>
  </conbody>
</concept>
END

  owf(fpe($in, 2, q(dita)), <<END);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE reference PUBLIC "-//PHIL//DTD DITA Task//EN" "concept.dtd" []>
<concept id="c2">
  <title>Concept 2 which does not refer to anything</title>
  <conbody>
     <p id="p1">Para 1 &lt;hello&gt; aaa &lt;goodbye&gt;</p>
     <p id="p2">Para 2 &lt;hello&gt; bbb &lt;goodbye&gt;</p>
  </conbody>
</concept>
END
 }

sub createSampleInputFilesLtGt($)                                               #P Create sample input files for testing items between &lt; and &gt;
 {my ($in) = @_;                                                                # Folder to create the files in
  owf(fpe($in, 1, q(dita)), <<END);
$conceptHeader
<concept id="c1">
  <title>Concept 1 which refers to concept 2</title>
  <conbody>
     <p>&lt;aaa&gt; AAAA &lt;bbb&gt;</p>
  </conbody>
</concept>
END
 }

sub createSampleInputFilesForFixDitaRefs($$)                                    #P Create sample input files for fixing renamed topic refs
 {my ($in, $targets) = @_;                                                      # Folder to create the files in, targets folder
  my $d = absFromAbsPlusRel(currentDirectory, $in);
  my @targets;

  push @targets, [owf(fpe($in, 1, q(ditamap)), <<END), q(1.ditamap)];
<map xtrf="${d}1.ditamap">
  <title>aaaa map</title>
  <topicref href="a.dita"/>
</map>
END

  push @targets, [owf(fpe($in, qw(a1 dita)), <<END), q(a.dita)];
<concept id="ca1" xtrf="${d}a.dita">
  <title>aaaa topic 111</title>
  <conbody>
    <p id="a1" conref="b.dita#b/b1"/>
  </conbody>
</concept>
END

  push @targets, [owf(fpe($in, qw(a2 dita)), <<END), q(a2.dita)];
<concept id="ca2" xtrf="${d}a.dita">
  <title>aaaa topic 222</title>
  <conbody>
    <p id="a2" conref="#./a1"/>
  </conbody>
</concept>
END

  push @targets, [owf(fpe($in, qw(b1 dita)), <<END), q(b1.dita)];
<concept id="cb1" xtrf="${d}b.dita">
  <title>bbbb topic 111</title>
  <conbody>
    <p id="b1" conref="a.dita#a/a1"/>
  </conbody>
</concept>
END

  push @targets, [owf(fpe($in, qw(b2 dita)), <<END), q(b2.dita)];
<concept id="cb2" xtrf="${d}b.dita">
  <title>bbbb topic 222</title>
  <conbody>
    <p id="b2" conref="#./b2"/>
  </conbody>
</concept>
END

  for my $target(@targets)                                                      # Create targets folder
   {owf(fpf($targets, $$target[1]), $$target[0]);
   }
 }

sub createSampleInputFilesForFixDitaRefsXref($)                                 #P Create sample input files for fixing references into renamed topics by xref
 {my ($in) = @_;                                                                # Folder to create the files in
  my $d = fpd(currentDirectory, $in);
  owf(fpe($in, qw(a1 dita)), <<END);
<concept id="ca1" xtrf="${d}a.dita">
  <title>aaaa topic 111</title>
  <conbody>
    <xref href="b.dita#b/b1"/>
  </conbody>
</concept>
END
  owf(fpe($in, qw(b1 dita)), <<END);
<concept id="cb1" xtrf="${d}b.dita">
  <title>bbbb topic 111</title>
  <conbody>
    <p id="b1"/>
  </conbody>
</concept>
END
  owf(fpe($in, qw(b2 dita)), <<END);
<concept id="cb2" xtrf="${d}b.dita">
  <title>bbbb topic 222</title>
  <conbody>
    <p id="b2"/>
  </conbody>
</concept>
END
 }

sub createSampleConRefs($)                                                      #P Create sample input files for fixing a conref
 {my ($in) = @_;                                                                # Folder to create the files in
  my $d = fpd(currentDirectory, $in);
  owf(fpe($in, qw(c1 dita)), <<END);
<concept id="c1">
  <title>1111</title>
  <conbody>
    <p id="i1" conref="c2.dita#c2/p1"/>
    <p id="i2" conref="c2.dita#c2/p2"/>
    <p id="i2" conref="c2.dita#c2/p3"/>
    <xref id="c1" href="c1.dita#c1/i1"/>
    <xref id="x1" href="c1.dita#c1/i2"/>
    <xref href="c1.dita#c1/i3"/>
    <xref href="c1.dita#c1/i3"/>
    <xref href="c1.dita#c1/i3"/>
  </conbody>
</concept>
END
  owf(fpe($in, qw(c2 dita)), <<END);
<concept id="c2">
  <title id="c2">2222</title>
  <conbody>
    <p id="p1">p1p1p1p1</p>
    <p id="p2">p2p2p2p2</p>
  </conbody>
</concept>
END
 }

sub createSampleConRefMatching($)                                               #P Create sample input files for matching conref source and targets
 {my ($in) = @_;                                                                # Folder to create the files in
  my $d = fpd(currentDirectory, $in);
  owf(fpe($in, qw(c1 dita)), <<END);
<concept id="c1">
  <title>1111</title>
  <conbody>
    <p conref="c2.dita#c2/p1"/>
    <p conref="c2.dita#c2/q1"/>
  </conbody>
</concept>
END
  owf(fpe($in, qw(c2 dita)), <<END);
<concept id="c2">
  <title>2222</title>
  <conbody>
    <p id="p1">p1p1p1p1</p>
    <q id="q1">q1q1q1q1</q>
  </conbody>
</concept>
END
 }

sub createSampleDuplicateMd5Sum($)                                              #P Create sample input files with duplicate md5 sums
 {my ($in) = @_;                                                                # Folder to create the files in
  my $d = fpd(currentDirectory, $in);
  owf(fpe($in, $_, qw(c dita)), <<END) for 1..3;
<concept/>
END
  owf(fpe($in, $_, qw(t dita)), <<END) for 1..2;
<task/>
END
 }

sub createSampleUnreferencedIds($)                                              #P Create sample input files with unreferenced ids
 {my ($in) = @_;                                                                # Folder to create the files in
  my $d = fpd(currentDirectory, $in);
  owf(fpe($in, $_, qw(c1 dita)), <<END);
<concept id="c1">
  <title id="c1"/>
  <conbody>
    <p id="p1"/>
    <p id="p2"/>
    <p id="p2"/>
    <p id="p3"/>
    <p id="p3"/>
    <p id="p3"/>
  </conbody>
</concept>
END
  owf(fpe($in, $_, qw(c2 dita)), <<END);
<concept id="c2">
  <title id="c2"/>
  <conbody>
    <p href="c1.dita#p1"/>
    <p conref="c1.dita#c1/p2"/>
  </conbody>
</concept>
END
 }

sub createEmptyBody($)                                                          #P Create sample input files for empty body detection
 {my ($in) = @_;                                                                # Folder to create the files in
  my $d = fpd(currentDirectory, $in);
  owf(fpe($in, qw(c1 dita)), <<END);
$conceptHeader
<concept id="c1">
  <title>Empty</title>
  <conbody/>
</concept>
END
  owf(fpe($in, qw(c2 dita)), <<END);
$conceptHeader
<concept id="c2">
  <title>Full</title>
  <conbody>
    <p>2222</p>
  </conbody>
</concept>
END
 }

sub createClassificationMapsTest($)                                             #P Create sample input files for a classification map
 {my ($in) = @_;                                                                # Folder to create the files in
  my $d = fpd($in);
  owf(fpe($in, qw(maps m1 ditamap)), <<END);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map id="m1">
    <title>A map that is not nested</title>
    <mapref   href="m2.ditamap"/>
    <topicref href="../c1.dita"/>
    <topicref href="../c2.dita"/>
</map>
END
  owf(fpe($in, qw(maps m2 ditamap)), <<END);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map id="m2">
    <title>A map that is nested</title>
    <topicref href="../c1.dita"/>
    <topicref href="../c2.dita"/>
</map>
END
  owf(fpe($in, qw(c1 dita)), <<END);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="c1">
    <title>Concept 1</title>
    <prolog>
        <metadata>
            <othermeta content="concept" name="topic_type ee ee aa"/>
            <othermeta content="Developer_Guide_Reference Salesforce_Console" name="app_area"/>
        </metadata>
    </prolog>
    <conbody/>
</concept>
END
  owf(fpe($in, qw(c2 dita)), <<END);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="c2">
    <title>Concept 2</title>
    <prolog>
        <metadata>
            <othermeta content="Developer Partner" name="role"/>
            <othermeta content="PE EE PXE UE DE" name="edition"/>
            <othermeta content="aloha sfx aloha" name="ui_platform"/>
        </metadata>
    </prolog>
    <conbody/>
</concept>
END
 }

sub createWordsToFilesTest($)                                                   #P Index words to file
 {my ($in) = @_;                                                                # Folder to create the files in
  owf(fpe($in, qw(spaghetti dita)), <<END);
<task id="t1">
  <title>How to cook spaghetti</title>
  <taskbody>

    <context><p>You are in a well equipped kitchen with a packet of spaghetti
    to hand.  You wish to cook some spaghetti</p></context>

    <steps>
      <step>
        <cmd>Bring a large pan of water to a rolling boil</cmd>
      </step>
      <step>
        <cmd>Place the spaghetti in the boiling water</cmd>
      </step>
      <step>
        <cmd>Cover the pan with a lid and turn the heat down</cmd>
      </step>
      <step>
        <cmd>Cook for 15 minutes then drain through a collander</cmd>
      </step>
      </steps>
  </taskbody>
</task>
END
  owf(fpe($in, qw(tea dita)), <<END);
<task id="t2">
  <title>How to make a cup of tea</title>
  <taskbody>

    <context><p>You are in a well equipped kitchen with a packet of tea bags to hand.
    You wish to make a cup of tea</p></context>

    <steps>
      <step>
        <cmd>Bring a kettle of water to the boil</cmd>
      </step>
      <step>
        <cmd>Place a tea bag in an insulated glass</cmd>
      </step>
      <step>
        <cmd>Pour hot water over the tea bag until the glass is 80% full</cmd>
      </step>
      <step>
        <cmd>Place the glass in a microwave oven and power for 30 seconds.</cmd>
      </step>
      </steps>
  </taskbody>
</task>
END
 }

sub createUrlTests($)                                                           #P Check urls
 {my ($in) = @_;                                                                # Folder to create the files in
  owf(fpe($in, qw(concept dita)), <<END);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="c">
  <title>Urls</title>
  <conbody>
    <p><xref format="html" href="https://www.appaapps.com" scope="external">aaa</xref></p>
    <p><xref format="html" href="https://ww2.appaapps.com" scope="external">bbb</xref></p>
  </conbody>
</concept>
END
 }

sub changeFolderAndWriteFiles($$)                                               #P Change file structure to the current folder and write
 {my ($f, $D) = @_;                                                             # Data structure as a string, target folder
  my $d = q(/home/phil/perl/cpan/DataEditXmlToDita/test/);
  my $F = eval(dump($f) =~ s($d) ($D)gsr);
  writeFiles($F);                                                               # Change folder and write test files
 }

sub createSampleInputFilesForFixDitaRefsImproved1($)                            #P Create sample input files for fixing references via the targets/ folder
 {my ($folder) = @_;                                                            # Folder to switch to
  my $f = {
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_4ef751d67c53ac33272c3bbe16284b0d.ditamap"  => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []>\\n<bookmap id=\\"GUID-18c89db5-781b-666a-f24a-fbafa6d70733\\">\\n  <chapter href=\\"a.dita\\" navtitle=\\"aaaa\\">\\n    <topicref href=\\"b.dita\\" navtitle=\\"aaaa\\"/>\\n  </chapter>\\n</bookmap>\\n<!--linted: 2019-06-22 at 21:16:47 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: bookmap -->\\n<!--docType: <!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_4ef751d67c53ac33272c3bbe16284b0d.ditamap -->\\n<!--guid: GUID-18c89db5-781b-666a-f24a-fbafa6d70733 -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/ab.ditamap -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 885 -->\\n<!--project: all -->\\n<!--title: ab -->\\n<!--definition: GUID-18c89db5-781b-666a-f24a-fbafa6d70733 -->\\n<!--labels: GUID-18c89db5-781b-666a-f24a-fbafa6d70733 b1 -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_ca202b3f0a58c67675f9704a32546cea.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-1581d732-b13a-edf0-2651-220a78f1c0fa\\">\\n  <title>aaaa</title>\\n  <conbody>\\n    <p>Aaa aaa aaa</p>\\n  </conbody>\\n</concept>\\n<!--linted: 2019-06-22 at 21:16:47 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_ca202b3f0a58c67675f9704a32546cea.dita -->\\n<!--guid: GUID-1581d732-b13a-edf0-2651-220a78f1c0fa -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/b.dita -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 885 -->\\n<!--project: all -->\\n<!--title: aaaa -->\\n<!--definition: GUID-1581d732-b13a-edf0-2651-220a78f1c0fa -->\\n<!--labels: GUID-1581d732-b13a-edf0-2651-220a78f1c0fa cb -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/a.dita"                                   => "{\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_ca202b3f0a58c67675f9704a32546cea.dita\\",\\n  targetType => \\"topic\\",\\n}",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/ab.ditamap"                               => "{\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/ab.ditamap\\",\\n  sourceDocType => \\"bookmap\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_4ef751d67c53ac33272c3bbe16284b0d.ditamap\\",\\n  targetType => \\"bookmap\\",\\n}",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/b.dita"                                   => "{\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/b.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_ca202b3f0a58c67675f9704a32546cea.dita\\",\\n  targetType => \\"topic\\",\\n}",
  };

  changeFolderAndWriteFiles($f, $folder);                                       # Change folder and write files
 }

sub createSampleInputFilesForFixDitaRefsImproved2($)                            #P Create sample input files for fixing conref references via the targets/ folder
 {my ($folder) = @_;                                                            # Folder to switch to
  my $f = {
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_c8e30fbb422819ab92e1752ca50bb158.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-48fb251a-9a88-3bcc-d81b-301f426ed439\\">\\n  <title>aaaa</title>\\n  <conbody>\\n    <p conref=\\"b.dita#cb/p1\\">aaaa</p>\\n  </conbody>\\n</concept>\\n<!--linted: 2019-06-22 at 21:16:47 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_c8e30fbb422819ab92e1752ca50bb158.dita -->\\n<!--guid: GUID-48fb251a-9a88-3bcc-d81b-301f426ed439 -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 885 -->\\n<!--project: all -->\\n<!--title: aaaa -->\\n<!--definition: GUID-48fb251a-9a88-3bcc-d81b-301f426ed439 -->\\n<!--labels: GUID-48fb251a-9a88-3bcc-d81b-301f426ed439 ca -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_e374c26206dc955160cecea10306509d.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-e9997c20-3dcf-6958-f762-09d8250bc53e\\">\\n  <title>bbbb</title>\\n  <conbody>\\n    <p id=\\"p1\\">bbbb</p>\\n  </conbody>\\n</concept>\\n<!--linted: 2019-06-22 at 21:16:47 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_e374c26206dc955160cecea10306509d.dita -->\\n<!--guid: GUID-e9997c20-3dcf-6958-f762-09d8250bc53e -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/b.dita -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 885 -->\\n<!--project: all -->\\n<!--title: bbbb -->\\n<!--definition: p1 -->\\n<!--definition: GUID-e9997c20-3dcf-6958-f762-09d8250bc53e -->\\n<!--labels: GUID-e9997c20-3dcf-6958-f762-09d8250bc53e cb -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/a.dita"                                   => "{\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_c8e30fbb422819ab92e1752ca50bb158.dita\\",\\n  targetType => \\"topic\\",\\n}",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/b.dita"                                   => "{\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/b.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_e374c26206dc955160cecea10306509d.dita\\",\\n  targetType => \\"topic\\",\\n}",
  };

  changeFolderAndWriteFiles($f, $folder);                                       # Change folder and write files
 }

sub createSampleInputFilesForFixDitaRefsImproved3($)                            #P Create sample input files for fixing bookmap references to topics that get cut into multiple pieces
 {my ($folder) = @_;                                                            # Folder to switch to
  my $f = {
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_6661b95b6e3802e892116df5a3307e8f.ditamap"   => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []>\\n<bookmap id=\\"GUID-2a901384-59f3-9fdb-de14-546a63d03dfa\\">\\n  <chapter href=\\"a.dita\\" navtitle=\\"aaaa\\"/>\\n</bookmap>\\n<!--linted: 2019-06-25 at 21:04:31 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: bookmap -->\\n<!--docType: <!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_6661b95b6e3802e892116df5a3307e8f.ditamap -->\\n<!--guid: GUID-2a901384-59f3-9fdb-de14-546a63d03dfa -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.ditamap -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 929 -->\\n<!--project: all -->\\n<!--title: a -->\\n<!--definition: GUID-2a901384-59f3-9fdb-de14-546a63d03dfa -->\\n<!--labels: GUID-2a901384-59f3-9fdb-de14-546a63d03dfa bm -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_a_6b2bcb0e0a5337f3bb3b28099e892b3d.ditamap" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []>\\n<bookmap id=\\"GUID-8e2504aa-ea92-9307-7bd1-82f52370aca2\\">\\n  <booktitle>\\n    <mainbooktitle>a</mainbooktitle>\\n  </booktitle>\\n  <bookmeta>\\n    <shortdesc/>\\n    <author/>\\n    <source/>\\n    <category/>\\n    <keywords>\\n      <keyword/>\\n    </keywords>\\n    <prodinfo>\\n      <prodname product=\\"\\"/>\\n      <vrmlist>\\n        <vrm version=\\"\\"/>\\n      </vrmlist>\\n      <prognum/>\\n      <brand/>\\n    </prodinfo>\\n    <bookchangehistory>\\n      <approved>\\n        <revisionid/>\\n      </approved>\\n    </bookchangehistory>\\n    <bookrights>\\n      <copyrfirst>\\n        <year/>\\n      </copyrfirst>\\n      <bookowner/>\\n    </bookrights>\\n  </bookmeta>\\n  <frontmatter>\\n    <notices/>\\n    <booklists>\\n      <toc/>\\n    </booklists>\\n    <preface/>\\n  </frontmatter>\\n  <chapter href=\\"c_aaaa_e56ab0e797826adf7d4fef41f9c39fe1.dita\\" navtitle=\\"aaaa\\">\\n    <topicref href=\\"c_bbbb_e374c26206dc955160cecea10306509d.dita\\" navtitle=\\"bbbb\\"/>\\n  </chapter>\\n  <appendices/>\\n  <reltable>\\n    <relheader>\\n      <relcolspec/>\\n      <relcolspec/>\\n    </relheader>\\n    <relrow>\\n      <relcell/>\\n      <relcell/>\\n    </relrow>\\n    <relrow>\\n      <relcell/>\\n      <relcell/>\\n    </relrow>\\n  </reltable>\\n</bookmap>\\n<!--linted: 2019-06-25 at 21:04:32 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: bookmap -->\\n<!--docType: <!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_a_6b2bcb0e0a5337f3bb3b28099e892b3d.ditamap -->\\n<!--guid: GUID-8e2504aa-ea92-9307-7bd1-82f52370aca2 -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 929 -->\\n<!--project: all -->\\n<!--title: a -->\\n<!--definition: GUID-8e2504aa-ea92-9307-7bd1-82f52370aca2 -->\\n<!--labels: GUID-8e2504aa-ea92-9307-7bd1-82f52370aca2 GUID-d42dec6e-0ce9-ebc1-c018-e656df6c3a06 -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_e56ab0e797826adf7d4fef41f9c39fe1.dita"  => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-fa5dea13-6bbb-2d62-2a55-f5feefe9ae89\\">\\n  <title>aaaa</title>\\n  <conbody>\\n    <p>aaaa</p>\\n  </conbody>\\n</concept>\\n<!--linted: 2019-06-25 at 21:04:32 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_e56ab0e797826adf7d4fef41f9c39fe1.dita -->\\n<!--guid: GUID-fa5dea13-6bbb-2d62-2a55-f5feefe9ae89 -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 929 -->\\n<!--project: all -->\\n<!--title: aaaa -->\\n<!--definition: GUID-fa5dea13-6bbb-2d62-2a55-f5feefe9ae89 -->\\n<!--labels: GUID-fa5dea13-6bbb-2d62-2a55-f5feefe9ae89 ca -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_e374c26206dc955160cecea10306509d.dita"  => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-e9997c20-3dcf-6958-f762-09d8250bc53e\\">\\n  <title>bbbb</title>\\n  <conbody>\\n    <p id=\\"p1\\">bbbb</p>\\n  </conbody>\\n</concept>\\n<!--linted: 2019-06-25 at 21:04:31 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_e374c26206dc955160cecea10306509d.dita -->\\n<!--guid: GUID-e9997c20-3dcf-6958-f762-09d8250bc53e -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 929 -->\\n<!--project: all -->\\n<!--title: bbbb -->\\n<!--definition: p1 -->\\n<!--definition: GUID-e9997c20-3dcf-6958-f762-09d8250bc53e -->\\n<!--labels: GUID-e9997c20-3dcf-6958-f762-09d8250bc53e cb -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/a.dita"                                    => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_a_6b2bcb0e0a5337f3bb3b28099e892b3d.ditamap\\",\\n  targetType => \\"bookmap\\",\\n}, \\"SourceToTarget\\")",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/a.ditamap"                                 => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/a.ditamap\\",\\n  sourceDocType => \\"bookmap\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_6661b95b6e3802e892116df5a3307e8f.ditamap\\",\\n  targetType => \\"bookmap\\",\\n}, \\"SourceToTarget\\")",
  };

  changeFolderAndWriteFiles($f, $folder);                                       # Change folder and write files
 }

sub createSampleInputFilesForFixDitaRefsImproved4($)                            #P Create sample input files for fixing bookmap reference to a topic that did not get cut into  multiple pieces
 {my ($folder) = @_;                                                            # Folder to switch to
  my $f = {
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_6661b95b6e3802e892116df5a3307e8f.ditamap"  => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []>\\n<bookmap id=\\"GUID-2a901384-59f3-9fdb-de14-546a63d03dfa\\">\\n  <chapter href=\\"a.dita\\" navtitle=\\"aaaa\\"/>\\n</bookmap>\\n<!--linted: 2019-06-25 at 22:41:31 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: bookmap -->\\n<!--docType: <!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_6661b95b6e3802e892116df5a3307e8f.ditamap -->\\n<!--guid: GUID-2a901384-59f3-9fdb-de14-546a63d03dfa -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.ditamap -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 929 -->\\n<!--project: all -->\\n<!--title: a -->\\n<!--definition: GUID-2a901384-59f3-9fdb-de14-546a63d03dfa -->\\n<!--labels: GUID-2a901384-59f3-9fdb-de14-546a63d03dfa bm -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_e56ab0e797826adf7d4fef41f9c39fe1.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-fa5dea13-6bbb-2d62-2a55-f5feefe9ae89\\">\\n  <title>aaaa</title>\\n  <conbody>\\n    <p>aaaa</p>\\n  </conbody>\\n</concept>\\n<!--linted: 2019-06-25 at 22:41:31 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_e56ab0e797826adf7d4fef41f9c39fe1.dita -->\\n<!--guid: GUID-fa5dea13-6bbb-2d62-2a55-f5feefe9ae89 -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 929 -->\\n<!--project: all -->\\n<!--title: aaaa -->\\n<!--definition: GUID-fa5dea13-6bbb-2d62-2a55-f5feefe9ae89 -->\\n<!--labels: GUID-fa5dea13-6bbb-2d62-2a55-f5feefe9ae89 ca -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/a.dita"                                   => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_e56ab0e797826adf7d4fef41f9c39fe1.dita\\",\\n  targetType => \\"topic\\",\\n}, \\"SourceToTarget\\")",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/a.ditamap"                                => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/a.ditamap\\",\\n  sourceDocType => \\"bookmap\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_6661b95b6e3802e892116df5a3307e8f.ditamap\\",\\n  targetType => \\"bookmap\\",\\n}, \\"SourceToTarget\\")",
  };

  changeFolderAndWriteFiles($f, $folder);                                       # Change folder and write files
 }

sub createSampleImageTest($)                                                    #P Create sample input files for fixing bookmap reference to a topic that did not get cut into  multiple pieces
 {my ($folder) = @_;                                                            # Folder to switch to

  my $f = {
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_concept_1_476bcb2107e9e6c19659ac20ae123fe6.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-3984fb53-1379-7649-e0ac-272f39376156\\">\\n  <title>concept 1</title>\\n  <conbody>\\n    <image href=\\"png_31d0017136191f418bbef189d417802a.png\\"/>\\n    <image href=\\"../images/b.png\\"/>\\n  </conbody>\\n</concept>\\n\\n<!--linted: 2019-07-05 at 23:31:12 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_concept_1_476bcb2107e9e6c19659ac20ae123fe6.dita -->\\n<!--guid: GUID-3984fb53-1379-7649-e0ac-272f39376156 -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/concepts/c.dita -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: concept 1 -->\\n<!--definition: GUID-3984fb53-1379-7649-e0ac-272f39376156 -->\\n<!--labels: GUID-3984fb53-1379-7649-e0ac-272f39376156 c1 -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/png_31d0017136191f418bbef189d417802a"              => "{\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/download/images/a.png\\",\\n}",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/png_31d0017136191f418bbef189d417802a.png"          => "png image a\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/concepts/c.dita"                               => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/concepts/c.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_concept_1_476bcb2107e9e6c19659ac20ae123fe6.dita\\",\\n  targetType => \\"topic\\",\\n}, \\"SourceToTarget\\")",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/images/a.png"                                  => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/download/images/a.png\\",\\n  sourceDocType => \\"image\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/png_31d0017136191f418bbef189d417802a.png\\",\\n  targetType => \\"image\\",\\n}, \\"SourceToTarget\\")",
  };

  changeFolderAndWriteFiles($f, $folder);                                       # Change folder and write files
 }

sub createTestTopicFlattening($)                                                #P Create sample input files for testing topic flattening ratio reporting
 {my ($folder) = @_;                                                            # Folder to switch to

  my $f = {
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_2b1faeb8f74e670e20450cde864e2e46.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-707b18f0-a3e8-2566-446f-cdcfc467318c\\">\\n  <title/>\\n  <conbody/>\\n</concept>\\n<!--linted: 2019-07-06 at 22:01:57 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_2b1faeb8f74e670e20450cde864e2e46.dita -->\\n<!--guid: GUID-707b18f0-a3e8-2566-446f-cdcfc467318c -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/c1.dita -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--definition: GUID-707b18f0-a3e8-2566-446f-cdcfc467318c -->\\n<!--labels: GUID-707b18f0-a3e8-2566-446f-cdcfc467318c c -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/c1.dita"                             => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/c1.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_2b1faeb8f74e670e20450cde864e2e46.dita\\",\\n  targetType => \\"topic\\",\\n}, \\"SourceToTarget\\")",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/c2.dita"                             => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/c2.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_2b1faeb8f74e670e20450cde864e2e46.dita\\",\\n  targetType => \\"topic\\",\\n}, \\"SourceToTarget\\")",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/c3.dita"                             => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/c3.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_2b1faeb8f74e670e20450cde864e2e46.dita\\",\\n  targetType => \\"topic\\",\\n}, \\"SourceToTarget\\")",
  };

  changeFolderAndWriteFiles($f, $folder);                                       # Change folder and write files
 }

sub createTestReferencedToFlattenedTopic($)                                     #P Full reference to a topic that has been flattened
 {my ($folder) = @_;                                                            # Folder to switch to

  my $f = {
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_3119ee09e34375ed4d8a7a15274a9774.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-7b56e1e5-a8b5-7f09-73e5-e6ecb15d5e8f\\">\\n  <title>aaaa</title>\\n  <conbody>\\n    <p conref=\\"b.dita#c/p1\\"/>\\n  </conbody>\\n</concept>\\n\\n<!--linted: 2019-07-07 at 00:40:33 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_3119ee09e34375ed4d8a7a15274a9774.dita -->\\n<!--guid: GUID-7b56e1e5-a8b5-7f09-73e5-e6ecb15d5e8f -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: aaaa -->\\n<!--definition: GUID-7b56e1e5-a8b5-7f09-73e5-e6ecb15d5e8f -->\\n<!--labels: GUID-7b56e1e5-a8b5-7f09-73e5-e6ecb15d5e8f c -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_8b028dc2faaca88ac747b3776189d4a6.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-d003c721-d7e5-e4e8-3d84-ba7b4c80f56c\\">\\n  <title>aaaa</title>\\n  <conbody>\\n    <p id=\\"p1\\">pppp</p>\\n  </conbody>\\n</concept>\\n<!--linted: 2019-07-07 at 00:40:33 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_8b028dc2faaca88ac747b3776189d4a6.dita -->\\n<!--guid: GUID-d003c721-d7e5-e4e8-3d84-ba7b4c80f56c -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/c.ditamap -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: aaaa -->\\n<!--definition: p1 -->\\n<!--definition: GUID-d003c721-d7e5-e4e8-3d84-ba7b4c80f56c -->\\n<!--labels: GUID-d003c721-d7e5-e4e8-3d84-ba7b4c80f56c c -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/a.dita"                                   => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_3119ee09e34375ed4d8a7a15274a9774.dita\\",\\n  targetType => \\"topic\\",\\n}, \\"SourceToTarget\\")",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/b.dita"                                   => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/b.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_8b028dc2faaca88ac747b3776189d4a6.dita\\",\\n  targetType => \\"topic\\",\\n}, \\"SourceToTarget\\")",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/c.ditamap"                                => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/c.ditamap\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_8b028dc2faaca88ac747b3776189d4a6.dita\\",\\n  targetType => \\"topic\\",\\n}, \\"SourceToTarget\\")",
  };

  changeFolderAndWriteFiles($f, $folder);                                       # Change folder and write files
 }

sub createTestReferenceToCutOutTopic($)                                         #P References from a topic that has been cut out to a topic that has been cut out
 {my ($folder) = @_;                                                            # Folder to switch to

  my $f = {
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []>\\n<bookmap id=\\"GUID-80a6bceb-0817-2a54-4d9e-ea67eed112b3\\">\\n  <booktitle>\\n    <mainbooktitle>a</mainbooktitle>\\n  </booktitle>\\n  <bookmeta>\\n    <shortdesc/>\\n    <author/>\\n    <source/>\\n    <category/>\\n    <keywords>\\n      <keyword/>\\n    </keywords>\\n    <prodinfo>\\n      <prodname product=\\"\\"/>\\n      <vrmlist>\\n        <vrm version=\\"\\"/>\\n      </vrmlist>\\n      <prognum/>\\n      <brand/>\\n    </prodinfo>\\n    <bookchangehistory>\\n      <approved>\\n        <revisionid/>\\n      </approved>\\n    </bookchangehistory>\\n    <bookrights>\\n      <copyrfirst>\\n        <year/>\\n      </copyrfirst>\\n      <bookowner/>\\n    </bookrights>\\n  </bookmeta>\\n  <frontmatter>\\n    <notices/>\\n    <booklists>\\n      <toc/>\\n    </booklists>\\n    <preface/>\\n  </frontmatter>\\n  <chapter href=\\"c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita\\" navtitle=\\"aaaa\\">\\n    <topicref href=\\"c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita\\" navtitle=\\"aaaa bbbb\\">\\n      <topicref href=\\"c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita\\" navtitle=\\"aaaa cccc\\"/>\\n    </topicref>\\n    <topicref href=\\"c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita\\" navtitle=\\"aaaa dddd\\"/>\\n  </chapter>\\n  <appendices/>\\n  <reltable>\\n    <relheader>\\n      <relcolspec/>\\n      <relcolspec/>\\n    </relheader>\\n    <relrow>\\n      <relcell/>\\n      <relcell/>\\n    </relrow>\\n    <relrow>\\n      <relcell/>\\n      <relcell/>\\n    </relrow>\\n  </reltable>\\n</bookmap>\\n\\n<!--linted: 2019-07-07 at 20:33:58 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: bookmap -->\\n<!--docType: <!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap -->\\n<!--guid: GUID-80a6bceb-0817-2a54-4d9e-ea67eed112b3 -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.xml -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: a -->\\n<!--definition: GUID-80a6bceb-0817-2a54-4d9e-ea67eed112b3 -->\\n<!--labels: GUID-80a6bceb-0817-2a54-4d9e-ea67eed112b3 GUID-621a0a8a-4af5-08b9-a9ba-ed7a27b59934 -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []>\\n<bookmap id=\\"GUID-21696006-94ec-4e53-78c5-24a93641a474\\">\\n  <booktitle>\\n    <mainbooktitle>b</mainbooktitle>\\n  </booktitle>\\n  <bookmeta>\\n    <shortdesc/>\\n    <author/>\\n    <source/>\\n    <category/>\\n    <keywords>\\n      <keyword/>\\n    </keywords>\\n    <prodinfo>\\n      <prodname product=\\"\\"/>\\n      <vrmlist>\\n        <vrm version=\\"\\"/>\\n      </vrmlist>\\n      <prognum/>\\n      <brand/>\\n    </prodinfo>\\n    <bookchangehistory>\\n      <approved>\\n        <revisionid/>\\n      </approved>\\n    </bookchangehistory>\\n    <bookrights>\\n      <copyrfirst>\\n        <year/>\\n      </copyrfirst>\\n      <bookowner/>\\n    </bookrights>\\n  </bookmeta>\\n  <frontmatter>\\n    <notices/>\\n    <booklists>\\n      <toc/>\\n    </booklists>\\n    <preface/>\\n  </frontmatter>\\n  <chapter href=\\"c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita\\" navtitle=\\"bbbb\\">\\n    <topicref href=\\"c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita\\" navtitle=\\"bbbb aaaa\\">\\n      <topicref href=\\"c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita\\" navtitle=\\"bbbb bbbb\\"/>\\n    </topicref>\\n    <topicref href=\\"c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita\\" navtitle=\\"bbbb cccc\\"/>\\n  </chapter>\\n  <appendices/>\\n  <reltable>\\n    <relheader>\\n      <relcolspec/>\\n      <relcolspec/>\\n    </relheader>\\n    <relrow>\\n      <relcell/>\\n      <relcell/>\\n    </relrow>\\n    <relrow>\\n      <relcell/>\\n      <relcell/>\\n    </relrow>\\n  </reltable>\\n</bookmap>\\n\\n<!--linted: 2019-07-07 at 20:33:58 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: bookmap -->\\n<!--docType: <!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_b_d2806ba589f908da1106574afd9db642.ditamap -->\\n<!--guid: GUID-21696006-94ec-4e53-78c5-24a93641a474 -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/b.xml -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: b -->\\n<!--definition: GUID-21696006-94ec-4e53-78c5-24a93641a474 -->\\n<!--labels: GUID-21696006-94ec-4e53-78c5-24a93641a474 GUID-b3f88460-8608-df56-bc6c-1215327bcc24 -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368\\">\\n  <title>aaaa</title>\\n  <conbody/>\\n</concept>\\n<!--linted: 2019-07-07 at 20:33:58 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita -->\\n<!--guid: GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368 -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.xml -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: aaaa -->\\n<!--definition: GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368 -->\\n<!--labels: GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368 a -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-f0c0e170-8128-10ef-045d-97602fdde76f\\">\\n  <title>aaaa bbbb</title>\\n  <conbody>\\n    <p conref=\\"b.xml#b/p1\\"/>\\n  </conbody>\\n</concept>\\n\\n<!--linted: 2019-07-07 at 20:33:58 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita -->\\n<!--guid: GUID-f0c0e170-8128-10ef-045d-97602fdde76f -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.xml -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: aaaa bbbb -->\\n<!--definition: GUID-f0c0e170-8128-10ef-045d-97602fdde76f -->\\n<!--labels: GUID-f0c0e170-8128-10ef-045d-97602fdde76f ab -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf\\">\\n  <title>aaaa cccc</title>\\n  <conbody>\\n    <p conref=\\"bb.xml#bb/p2\\"/>\\n  </conbody>\\n</concept>\\n\\n<!--linted: 2019-07-07 at 20:33:58 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita -->\\n<!--guid: GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.xml -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: aaaa cccc -->\\n<!--definition: GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf -->\\n<!--labels: GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf ac -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-68822563-d568-f418-38ae-f1c62cb4ac8d\\">\\n  <title>aaaa dddd</title>\\n  <conbody>\\n    <p conref=\\"b.xml#b/p3\\"/>\\n  </conbody>\\n</concept>\\n\\n<!--linted: 2019-07-07 at 20:33:58 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita -->\\n<!--guid: GUID-68822563-d568-f418-38ae-f1c62cb4ac8d -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.xml -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: aaaa dddd -->\\n<!--definition: GUID-68822563-d568-f418-38ae-f1c62cb4ac8d -->\\n<!--labels: GUID-68822563-d568-f418-38ae-f1c62cb4ac8d ad -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251\\">\\n  <title>bbbb</title>\\n  <conbody>\\n    <p id=\\"p1\\">1111</p>\\n  </conbody>\\n</concept>\\n<!--linted: 2019-07-07 at 20:33:58 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita -->\\n<!--guid: GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251 -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/b.xml -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: bbbb -->\\n<!--definition: p1 -->\\n<!--definition: GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251 -->\\n<!--labels: GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251 b -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc\\">\\n  <title>bbbb aaaa</title>\\n  <conbody/>\\n</concept>\\n<!--linted: 2019-07-07 at 20:33:58 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita -->\\n<!--guid: GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/b.xml -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: bbbb aaaa -->\\n<!--definition: GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc -->\\n<!--labels: GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc ba -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7\\">\\n  <title>bbbb bbbb</title>\\n  <conbody>\\n    <p id=\\"p2\\">2222</p>\\n  </conbody>\\n</concept>\\n<!--linted: 2019-07-07 at 20:33:58 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita -->\\n<!--guid: GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7 -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/b.xml -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: bbbb bbbb -->\\n<!--definition: p2 -->\\n<!--definition: GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7 -->\\n<!--labels: GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7 bb -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd\\">\\n  <title>bbbb cccc</title>\\n  <conbody>\\n    <p id=\\"p3\\">3333</p>\\n  </conbody>\\n</concept>\\n<!--linted: 2019-07-07 at 20:33:58 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita -->\\n<!--guid: GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/b.xml -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: bbbb cccc -->\\n<!--definition: p3 -->\\n<!--definition: GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd -->\\n<!--labels: GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd bc -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/a.xml"                                         => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/a.xml\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap\\",\\n  targetType => \\"bookmap\\",\\n}, \\"SourceToTarget\\")",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/b.xml"                                         => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/b.xml\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_b_d2806ba589f908da1106574afd9db642.ditamap\\",\\n  targetType => \\"bookmap\\",\\n}, \\"SourceToTarget\\")",
  };

  changeFolderAndWriteFiles($f, $folder);                                       # Change folder and write files
 }

sub createSampleOtherMeta($)                                                    #P Create sample data for othermeta reports
 {my ($out) = @_;                                                               # Folder

  package CreateSampleOtherMeta;
  use Carp;
  use Data::Dump qw(dump);
  use Data::Edit::Xml;
  use Data::Table::Text qw(:all);

  sub genMeta(%)                                                                # Generate meta data
   {my %m = @_;
    my @m;
    for my $n(sort keys %m)
     {my $c = $m{$n};
      push @m, qq(<othermeta name="$n" content="$c"/>);
     }
    join "\\n", @m;
   }

  sub genTopic($$$)                                                             # Generate a topic
   {my ($out, $name, $meta) = @_;

    my $c      = Data::Edit::Xml::ditaSampleConcept
     (title    => $name,
      metadata => $meta,
     );

    owf(fpe($out, $name, qw(dita)), $c->ditaPrettyPrintWithHeaders);
   }

  sub genMap($$$@)                                                              # Generate a bookmap
   {my ($out, $name, $meta, @chapters) = @_;

    my @r;
    for my $f(@chapters)
     {my $F = swapFilePrefix($f, $out);
      push @r, qq(<chapter href="$F"/>);
     }

    my $r = join "\\n", @r;

    my $b = Data::Edit::Xml::ditaSampleBookMap
     (chapters  => $r,
      metadata  => $meta,
      title     => $name,
     );

    owf(fpe($out, $name, qw(ditamap)), $b->ditaPrettyPrintWithHeaders);
   }

  clearFolder($out, 1e2);

  my %common = (aa=>q(AAAA), bb=>q(BBBB));

  my @topics =                                                                  # Topics
   (genTopic($out, q(ca), genMeta(%common, dd=>q(DD))),
    genTopic($out, q(cb), genMeta(%common, dd=>q(DD))),
   );

  genMap($out, q(b1), genMeta(%common, dd=>q(DD1111)), @topics);                # Bookmaps
  genMap($out, q(b2), genMeta(%common, dd=>q(DD2222)), @topics);
 } # createSampleOtherMeta

sub createTestOneNotRef($)                                                      #P One topic refernced and the other not
 {my ($folder) = @_;                                                            # Folder to switch to

  my $f = {
  "/home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita"    => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Task//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"ca\\">\\n  <title>aaaa</title>\\n  <conbody/>\\n</concept>\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/in/a.ditamap" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []>\\n<bookmap id=\\"bm\\">\\n  <chapter href=\\"a.dita\\" navtitle=\\"aaaa\\"/>\\n</bookmap>\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/in/b.dita"    => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Task//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"cb\\">\\n  <title>bbbb</title>\\n  <conbody/>\\n</concept>\\n",
  };

  changeFolderAndWriteFiles($f, $folder);                                       # Change folder and write files
 }

sub createSampleTopicsReferencedFromBookMaps($)                                 #P The number of times a topic is referenced from a bookmap
 {my ($in) = @_;                                                                # Folder to create the files in
  my $d = fpd(currentDirectory, $in);

  owf(fpe($in, qw(m1 dita)), <<END);
<map id="m1">
  <title>Map 1</title>
  <chapter href="c1.dita"/>
</map>
END

  owf(fpe($in, qw(m2 dita)), <<END);
<map id="m2">
  <title>Map 1</title>
  <topicref href="c1.dita"/>
  <topicref href="c2.dita"/>
</map>
END

  owf(fpe($in, qw(c1 dita)), <<END);
<concept id="c1">
  <title>c1</title>
  <conbody>
    <image href="1.png"/>;
  </conbody>
</concept>
END
  owf(fpe($in, qw(c2 dita)), <<END);
<concept id="c2">
  <title>c2</title>
  <conbody>
    <image href="1.png"/>;
    <image href="2.png"/>;
  </conbody>
</concept>
END
  owf(fpe($in, qw(c3 dita)), <<END);
<concept id="c3">
  <title>c3</title>
  <conbody>
    <image href="1.png"/>;
    <image href="2.png"/>;
    <image href="3.png"/>;
  </conbody>
</concept>
END
 }

sub createSampleImageReferences($)                                              #P Good and bad image references
 {my ($in) = @_;                                                                # Folder to create the files in
  my $d    = fpd(currentDirectory, $in);

  owf(fpe($in, qq(c$_), q(dita)), <<END) for 1..3;
<concept id="c$_">
  <title>C$_</title>
  <conbody>
    <image href="good1.png"/>
    <image href="good1.png"/>
    <image href="good2.png"/>
    <image href="good2.png"/>
    <image href="bad1.png"/>
    <image href="bad1.png"/>
  </conbody>
</concept>
END

  owf(fpe($in, qw(good1 png)), <<END);
<image/>
END

  owf(fpe($in, qw(good2 png)), <<END);
<image/>
END
 }

sub createRequiredCleanUps($)                                                   #P Required clean ups report
 {my ($in) = @_;                                                                # Folder to create the files in
  my $d    = fpd(currentDirectory, $in);

  owf(fpe($in, qq(c1), q(dita)), <<END);
<concept id="c1">
  <title>C1_</title>
  <conbody>
    <required-cleanup>aaa</required-cleanup>
    <required-cleanup>bbb</required-cleanup>
    <required-cleanup>bbb</required-cleanup>
  </conbody>
</concept>
END

  owf(fpe($in, qq(c2), q(dita)), <<END);
<concept id="c2">
  <title>C2_</title>
  <conbody>
    <required-cleanup>aaa</required-cleanup>
    <required-cleanup>bbb</required-cleanup>
    <required-cleanup>ccc</required-cleanup>
    <required-cleanup>CCC</required-cleanup>
  </conbody>
</concept>
END
 }

sub createSoftConrefs($)                                                        #P Fix file part of conref even if the rest is invalid
 {my ($in) = @_;                                                                # Folder to create the files in
  my $d    = fpd(currentDirectory, $in);

  my $r = fpe(qw(c_12345678123456781234567812345678 dita));                     # Relocatable
  owf(fpf($in, q(folder), $r), <<END);
$conceptHeader
<concept id="c">
  <title>C1</title>
  <conbody>
    <p id="p1">aaa</p>
    <p id="p1">bbb</p>
    <p conref="#c/p1"/>    <!-- FAILS -->
    <p conref="#c/pp"/>    <!-- FAILS: No such id -->
  </conbody>
</concept>
END

  owf(fpe($in, qw(c dita)), <<END);
$conceptHeader
<concept id="c">
  <title>C2</title>
  <conbody>
    <p conref="$r#c/p1"/>
    <p conref="$r#c1/p1"/>   <!-- PASSES: wrong topic id but we ignore topic ids-->
    <p conref="$r#c/bad"/>   <!-- PASSES: no such id - SHOULD FAIL even though we are relocating -->
    <p conref="$r"/>
    <p conref="c.dta"/>      <!-- FAILS: no such file -->
    <p id="q1">aaa</p>
    <p conref="#c/q1"/>
  </conbody>
</concept>
END
 }

sub checkXrefStructure($$@)                                                     #P Check an output structure produced by Xrf
 {my ($x, $field, @folders) = @_;                                               # Cross references, field to check, folders to suppress
  my $s = nws dump($x->{$field});                                               # Structure to be tested
  for my $folder($x->inputFolder, @folders)                                     # Remove specified folder names from structure to be tested
   {$s =~ s($folder) ()gs;                                                      # Remove folder name from structure to be tested
   }
  eval $s;                                                                      # Recreate structure
 }

sub writeXrefStructure($$@)                                                     #P Write the test for an Xref structure
 {my ($x, $field, @folders) = @_;                                               # Cross referencer, field, names of the folders to suppress

  my $in = $x->inputFolder;

  my $s = nws(dump($x->{$field}) =~ s($in) ()gsr);                              # Field to be tested
     $s =~ s(\\],\\s+\\[) (],\\n    [)gs;
     $s =~ s(\\},\\s+\\{) (},\\n    {)gs;

  for my $folderName(@folders)                                                  # Remove specified folder names from structure to be tested
   {no strict qw(refs);
    my $folder = &{$folderName};                                                # Folder name
    $s =~ s($folder) ()gs;                                                      # Remove folder name from structure to be tested
   }

  my $f = join \', \', @folders;                                                  # Folders to remove
  my $t = <<END;                                                                # Format test
  is_deeply checkXrefStructure(\\$x, q($field), $f), $s;
END

  say STDERR $t;                                                                # Write test
 }

sub deleteVariableFields($)                                                     #P Remove time and other fields that do not affect the end results
 {my ($x) = @_;                                                                 # Cross referencer
  delete $x->{$_} for qw(timeEnded timeStart maximumNumberOfProcesses);         # Remove time fields
  delete $x->{$_} for qw(tagsTextsRatio);                                       # Remove floating fields
  removeFilePathsFromStructure($x);
 }

sub testReferenceChecking                                                       #P Test reference checking
 {my $folder = q(/home/phil/);
  my @names  = qw(aaa bbb ccc);
  my @ids    = map {q(p).$_}                   @names;
  my @files  = map {fpe($folder, $_, q(dita))} @names;

  my $xref = newXref
   (currentFolder  => q(/aaa),
    reports        => fpd(currentDirectory, qw(test resports)),
    topicIds       => {map {$files[$_]=>$names[$_]}      0..$#names},
    ids            => {map {$files[$_]=>{$ids[$_]=>1}}   0..$#names},
   );

  for my $i(0..$#names)                                                         # Create some references
   {my $j = ($i + 1) % $#names;
    $xref->references->{$files[0]}{q(../phil/).$names[$i].q(.dita#).$names[$i].q(/).$ids[$i]}++;
    $xref->references->{$files[1]}{q(../phil/).$names[$i].q(.dita#).$names[$i].q(/).$ids[$j]}++;
    $xref->references->{$files[2]}{q(../phil/).$names[$i].q(.dita#).$names[$j].q(/).$ids[$i]}++;
   }

  ok !oneBadRef($xref, q(/home/phil/aaa.dita), q(../phil/bbb.dita#bbb/pbbb));   # Test reference checking
  ok !oneBadRef($xref, q(/home/phil/aaa.dita), q(../phil/bbb.dita));
  ok !oneBadRef($xref, q(/home/phil/aaa.dita), q(#aaa/paaa));
  ok !oneBadRef($xref, q(/home/phil/aaa.dita), q(#./paaa));
  ok !oneBadRef($xref, q(/home/phil/aaa.dita), q(#paaa));

  is_deeply oneBadRef($xref, q(/home/phil/aaa.dita), q(../phil/bbb.dita#bbb/pccc)),
   ["No such id in target topic",
    "../phil/bbb.dita#bbb/pccc",
    "/home/phil/bbb.dita",
    "bbb",
    "pccc",
    "aaa",
    "bbb",
    "/home/phil/aaa.dita",
    "/home/phil/bbb.dita",
  ];
  is_deeply oneBadRef($xref, q(/home/phil/aaa.dita), q(../phil/bbb.dita#aaa/pbbb)),
   ["Topic id does not match",
    "../phil/bbb.dita#aaa/pbbb",
    "/home/phil/bbb.dita",
    "aaa",
    "pbbb",
    "aaa",
    "bbb",
    "/home/phil/aaa.dita",
    "/home/phil/bbb.dita",
  ];
  is_deeply oneBadRef($xref, q(/home/phil/aaa.dita), q(../phil/ddd.dita#bbb/pbbb)),
   ["No such file",
    "../phil/ddd.dita#bbb/pbbb",
    "/home/phil/ddd.dita",
    "bbb",
    "pbbb",
    "aaa",
    undef,
    "/home/phil/aaa.dita",
    "/home/phil/ddd.dita",
  ];
  is_deeply oneBadRef($xref, q(/home/phil/aaa.dita), q(../phil/ddd.dita)),
  [ "No such file",
    "../phil/ddd.dita",
    "../phil/ddd.dita",
    "",
    "",
    "",
    "",
    "/home/phil/aaa.dita",
    "/home/phil/ddd.dita",
  ];
  is_deeply oneBadRef($xref, q(/home/phil/aaa.dita), q(#./pbbb)),
   ["No such id in target topic",
    "#./pbbb",
    "/home/phil/aaa.dita",
    "aaa",
    "pbbb",
    "aaa",
    "aaa",
    "/home/phil/aaa.dita",
    "/home/phil/aaa.dita",
  ];
  is_deeply oneBadRef($xref, q(/home/phil/aaa.dita), q(#bbb/pbbb)),
   ["Topic id does not match",
    "#bbb/pbbb",
    "/home/phil/aaa.dita",
    "bbb",
    "pbbb",
    "aaa",
    "aaa",
    "/home/phil/aaa.dita",
    "/home/phil/aaa.dita",
  ];
  is_deeply oneBadRef($xref, q(/home/phil/aaa.dita), q(#bbb/ccc)),
   ["Topic id does not match",
    "#bbb/ccc",
    "/home/phil/aaa.dita",
    "bbb",
    "ccc",
    "aaa",
    "aaa",
    "/home/phil/aaa.dita",
    "/home/phil/aaa.dita",
  ];

 checkReferences($xref);                                                        # Report fixes required

 is_deeply $xref->fixRefs,
  {"/home/phil/bbb.dita" => {
                              "../phil/aaa.dita#aaa/pbbb" => 1,
                              "../phil/bbb.dita#bbb/paaa" => 1,
                              "../phil/ccc.dita#ccc/pbbb" => 1,
                            },
   "/home/phil/ccc.dita" => {
                              "../phil/aaa.dita#bbb/paaa" => 1,
                              "../phil/bbb.dita#aaa/pbbb" => 1,
                              "../phil/ccc.dita#bbb/pccc" => 1,
                            },
 };


 } # testReferenceChecking

&testReferenceChecking;

if (1) {                                                                        # Fix xrefs by title  - there should be just one so fixed
lll "Test 001";
  clearFolder($_, 420) for in, out, reportFolder;
  createSampleInputFilesBaseCase(in, 8);

  my $x = xref(inputFolder => in,
               reports     => reportFolder,
               html        => reportFolder);
  ok $x->statusLine eq q(Xref: 104 refs, 21 image refs, 14 first lines, 14 second lines, 8 duplicate ids, 4 duplicate topic ids, 4 invalid guid hrefs, 2 duplicate files, 2 tables, 1 External xrefs with no format=html, 1 External xrefs with no scope=external, 1 file failed to parse, 1 href missing);

  #lll $x->statusLine;
  #say STDERR writeXrefStructure($x, q(publicId), q(in));
  is_deeply checkXrefStructure($x, q(publicId), in),
   {"1.dita" => undef, "2.dita" => undef, "3.dita" => undef, "4.dita" => undef,
    "5.dita" => undef, "6.dita" => undef, "7.dita" => undef, "8.dita" => undef,
    "act1.dita" => undef, "act4.dita" => undef, "act5.dita" => undef,
    "map/bookmap3.ditamap" => undef,
    "map/bookmap.ditamap"  => undef, "map/bookmap2.ditamap" => undef,
    "act2.dita"  => "-//OASIS//DTD DITA Task//EN",
    "table.dita" => "-//OASIS//DTD DITA Task//EN", };

  ok readFile(fpe(reportFolder, qw(bad duplicate_topics_ids html))) =~ m(<tr><td>c2<td>)is;
  ok readFile(fpe(reportFolder, qw(bad duplicate_topics_ids txt)))  =~ m(1  c2)is;

  my $y = xref(inputFolder => in, reports=>reportFolder, fixBadRefs => 1, fixXrefsByTitle => 1);       # Update error counts
  ok $y->statusLine eq q(Xref: 103 refs, 21 image refs, 14 first lines, 14 second lines, 8 duplicate ids, 4 duplicate topic ids, 4 invalid guid hrefs, 2 duplicate files, 2 tables, 1 External xrefs with no format=html, 1 External xrefs with no scope=external, 1 file failed to parse, 1 href missing);

  is_deeply checkXrefStructure($y, q(fixedRefsGood)),
   [[\'Fixed by Gearhart Title Method\', "xref", "href",
     "act1.dita#c1/title", "act1.dita", "act2.dita"]];
 }

if (1) {                                                                        #
lll "Test 002";
  clearFolder($_, 420) for in, out, reportFolder;
  createSampleInputFilesBaseCase(in, 8);

  my $x = xref(inputFolder                        => in,
               requestAttributeNameAndValueCounts => 1,
               reports                            => reportFolder,
               addNavTitles                       => 1,
               deguidize                          => 1,
               deleteUnusedIds                    => 1);


  ok $x->statusLine eq q(Xref: 88 refs, 18 image refs, 14 first lines, 14 second lines, 8 duplicate ids, 4 duplicate topic ids, 4 invalid guid hrefs, 2 duplicate files, 2 tables, 1 External xrefs with no format=html, 1 External xrefs with no scope=external, 1 file failed to parse, 1 href missing);

  is_deeply checkXrefStructure($x, q(topicsReferencedFromBookMaps)),
    {
      #"act2.dita"            => { "act1.dita" => 1, "act9999.dita" => 1 },
      "map/bookmap.ditamap"  => {
                                   "act1.dita"     => 1,
                                   "act2.dita"     => 1,
                                   "map/9999.dita" => 1,
                                   "map/bbb.txt"   => 1,
                                   "map/r.txt"     => 1,
                                   "map/yyyy.dita" => 1,
                                 },
      "map/bookmap2.ditamap" => {
                                   "act1.dita"     => 1,
                                   "act2.dita"     => 1,
                                   "map/9999.dita" => 1,
                                   "map/bbb.txt"   => 1,
                                   "map/r.txt"     => 1,
                                   "map/zzzz.dita" => 1,
                                 },
      "map/bookmap3.ditamap" => { "act3.dita" => 1, "act4.dita" => 1, "act5.dita" => 1 },
    };

  is_deeply checkXrefStructure($x, q(imagesReferencedFromBookMaps)),
   {#"act2.dita" => {
    #   "act1.png"  => 1,
    #   "act2.png"  => 1,
    #   "guid-000"  => 1,
    #   "guid-9999" => 1,
    #   "guid-act1" => 1,                                 inputFolder
    # },
     "map/bookmap.ditamap" => {
       "act1.png"  => 1,
       "act2.png"  => 1,
       "guid-000"  => 1,
       "guid-9999" => 1,
       "guid-act1" => 1,
     },
     "map/bookmap2.ditamap" => {
       "act1.png"  => 1,
       "act2.png"  => 1,
       "guid-000"  => 1,
       "guid-9999" => 1,
       "guid-act1" => 1,
     },
   };
 }

if (1) {                                                                          # Check topic matching
lll "Test 003";
  clearFolder($_, 420) for in, out, reportFolder;
  createSampleInputFilesBaseCase(in, 8);

  my $x = xref(inputFolder   => in,
               reports       => reportFolder,
               deguidize     => 1,
               fixBadRefs    => 1,
               matchTopics   => 0.9,
               flattenFolder => out,
               html          => reportFolder);

  ok $x->statusLine eq q(Xref: 97 refs, 20 image refs, 14 first lines, 14 second lines, 8 duplicate ids, 4 duplicate topic ids, 4 invalid guid hrefs, 2 duplicate files, 2 tables, 1 External xrefs with no format=html, 1 External xrefs with no scope=external, 1 file failed to parse, 1 href missing);
  ok readFile(fpe($x->reportFolder, qw(similar byVocabulary txt))) =~ m(1\\s+8.*in/1\\.dita);
 }

if (1) {                                                                        # Relocated refs
lll "Test 004";
  clearFolder($_, 420) for qw(in out reports);
  createSampleInputFilesBaseCase(in, 8);

  my $x = xref(inputFolder              => in,
               reports                  => reportFolder,
               deguidize                => 1,
               fixBadRefs               => 1,
               fixRelocatedRefs         => 1,
               fixedFolder              => outFixed,
               flattenFolder            => out);

  ok $x->statusLine eq q(Xref: 97 refs, 20 image refs, 14 first lines, 14 second lines, 8 duplicate ids, 4 duplicate topic ids, 4 invalid guid hrefs, 2 duplicate files, 2 tables, 1 External xrefs with no format=html, 1 External xrefs with no scope=external, 1 file failed to parse, 1 href missing);

  my $table = $x->statusTable;

  ok index($table, <<END) == 0;
    Count  Condition
 1     97  refs
 2     20  image refs
 3     14  first lines
 4     14  second lines
 5      8  duplicate ids
 6      4  invalid guid hrefs
 7      4  duplicate topic ids
 8      2  tables
 9      2  duplicate files
10      1  file failed to parse
11      1  href missing
12      1  External xrefs with no format=html
13      1  External xrefs with no scope=external
END

  is_deeply checkXrefStructure($x, q(fixedRefsGood), in, targets),
   [[ "Deguidized reference", "image",    "href",   "guid-000",                                          "act1.dita",            "act1.dita", ],
    [ "Deguidized reference", "link",     "href",   "guid-000",                                          "act1.dita",            "act2.dita", ],
    [ "Deguidized reference", "topicref", "href",   "guid-000",                                          "act1.dita",            "map/bookmap.ditamap", ],
    [ "Deguidized reference", "topicref", "href",   "guid-000",                                          "act1.dita",            "map/bookmap2.ditamap", ],
    [ "Deguidized reference", "xref",     "href",   "guid-000#c1/title2",                                "act1.dita",            "act2.dita", ],
    [ "Deguidized reference", "xref",     "href",   "guid-000#guid-000/title",                           "act1.dita",            "act2.dita", ],
    [ "Deguidized reference", "xref",     "href",   "guid-000#guid-000/title2",                          "act1.dita",            "act2.dita", ],
    [ "Deguidized reference", "xref",     "href",   "guid-001#guid-001/title guid-000#guid-000/title",   "act1.dita",            "act2.dita", ],
  #  [ "Relocated",            "p",        "conref", "bookmap.ditamap",                                   "map/bookmap.ditamap",  "act2.dita", ],
  #  [ "Relocated",            "p",        "conref", "bookmap2.ditamap",                                  "map/bookmap2.ditamap", "act2.dita", ],
  ];


# &writeXrefStructure($x, qw(fixedRefs in targets));
 }

if (!onAws) {                                                                   # Pending in AWS because we have not fixed deguidize to run in parallel
lll "Test 005 - Add Navtitles";
  my $N = 8;

  clearFolder($_, 420) for in, out, reportFolder;
  createSampleInputFilesBaseCase(in, $N);

  my $x = xref(inputFolder                        => in,
               requestAttributeNameAndValueCounts => 1,
               reports                            => reportFolder,
               addNavTitles                       => 1,
               deguidize                          => 1,
               deleteUnusedIds                    => 1);

  #&writeXrefStructure($x, qw(badNavTitles in));

  is_deeply checkXrefStructure($x, q(badNavTitles), in, targets),
   [["No title for target",  "chapter href=\\"yyyy.dita\\"",     "map/yyyy.dita",  "map/bookmap.ditamap"],
    ["No title for target",  "topicref href=\\"../map/r.txt\\"", "map/r.txt",      "map/bookmap.ditamap"],
    ["No title for target",  "topicref href=\\"9999.dita\\"",    "map/9999.dita",  "map/bookmap.ditamap"],
    ["No title for target",  "topicref href=\\"bbb.txt\\"",      "map/bbb.txt",    "map/bookmap.ditamap"],
    ["No file for guid",     "topicref href=\\"guid-888\\"",      undef,           "map/bookmap.ditamap"],
    ["No file for guid",     "topicref href=\\"guid-999\\"",      undef,           "map/bookmap.ditamap"],
    ["No title for target",  "chapter href=\\"zzzz.dita\\"",     "map/zzzz.dita",  "map/bookmap2.ditamap"],
    ["No title for target",  "topicref href=\\"../map/r.txt\\"", "map/r.txt",      "map/bookmap2.ditamap"],
    ["No title for target",  "topicref href=\\"9999.dita\\"",    "map/9999.dita",  "map/bookmap2.ditamap"],
    ["No title for target",  "topicref href=\\"bbb.txt\\"",      "map/bbb.txt",    "map/bookmap2.ditamap"],
    ["No file for guid",     "topicref href=\\"guid-888\\"",      undef,           "map/bookmap2.ditamap"],
    ["No file for guid",     "topicref href=\\"guid-999\\"",      undef,           "map/bookmap2.ditamap"],
    ["No title for target",  "chapter href=\\"../act3.dita\\"",  "act3.dita",      "map/bookmap3.ditamap"],
    ["No title for target",  "chapter href=\\"../act4.dita\\"",  "act4.dita",      "map/bookmap3.ditamap"],
    ["No title for target",  "chapter href=\\"../act5.dita\\"",  "act5.dita",      "map/bookmap3.ditamap"]];

  #&writeXrefStructure($x, qw(goodNavTitles in targets)); exit;

  my $y = xref(inputFolder                        => in,
               requestAttributeNameAndValueCounts => 1,
               reports                            => reportFolder,
               addNavTitles                       => 1,
               deguidize                          => 1,
               fixBadRefs                         => 1);

  is_deeply checkXrefStructure($y, q(goodNavTitles), in, targets),
   [[ "../act1.dita", "All Timing Codes Begin Here", "act1.dita", "map/bookmap.ditamap",  ],
    [ "../act1.dita", "All Timing Codes Begin Here", "act1.dita", "map/bookmap.ditamap",  ],
    [ "../act1.dita", "All Timing Codes Begin Here", "act1.dita", "map/bookmap2.ditamap", ],
    [ "../act1.dita", "All Timing Codes Begin Here", "act1.dita", "map/bookmap2.ditamap", ],
    [ "../act2.dita", "Jumping Through Hops",        "act2.dita", "map/bookmap.ditamap",  ],
    [ "../act2.dita", "Jumping Through Hops",        "act2.dita", "map/bookmap2.ditamap", ], ];

  my $r = fpe($x->reports, qw(count attributeNamesAndValues txt));
  ok -e $r && index(readFile($r), <<END) > 0;
Summary_of_column_Attribute
   Count  Attribute
1     98  href
2     29  id
3     20  conref
4      8  xtrf
5      2  navtitle
6      1  cols
7      1  format
END
 }
else
 {ok 1 for 1..3
 }

if (0) {                                                                        # Max zoom in - fails after upgrade to html reports
lll "Test 006";
  my $N = 8;

  clearFolder($_, 420) for in, out, reports;
  createSampleInputFiles(in, $N);

  my $x = xref(inputFolder => in,
               maxZoomIn   => {bad=>q(Bad), good=>q(Good)});

  is_deeply checkXrefStructure($x, q(maxZoomOut)),
   {"1.dita"               => { data => { bad => 3, good => 4 }, title => "Concept 1 refers to 2" },
    "2.dita"               => { data => { bad => 3, good => 4 }, title => "Concept 2 refers to 3" },
    "3.dita"               => { data => { bad => 3, good => 4 }, title => "Concept 3 refers to 4" },
    "4.dita"               => { data => { bad => 3, good => 4 }, title => "Concept 4 refers to 5" },
    "5.dita"               => { data => { bad => 3, good => 4 }, title => "Concept 5 refers to 6" },
    "6.dita"               => { data => { bad => 3, good => 4 }, title => "Concept 6 refers to 7" },
    "7.dita"               => { data => { bad => 3, good => 4 }, title => "Concept 7 refers to 8" },
    "8.dita"               => { data => { bad => 3, good => 4 }, title => "Concept 8 refers to 1" },
    "act1.dita"            => { data => {}, title => "All Timing Codes Begin Here" },
    "act2.dita"            => { data => {}, title => "Jumping Through Hops" },
    "act4.dita"            => { data => {}, title => undef },
    "act5.dita"            => { data => {}, title => undef },
    "map/bookmap.ditamap"  => { data => {}, title => "Test" },
    "map/bookmap2.ditamap" => { data => {}, title => "Test 2" },
    "map/bookmap3.ditamap" => { data => {}, title => "Test 3" },
    "table.dita"           => { data => {}, title => "Tables" },
   };
 }

if (1) {                                                                        # fixedFolder
lll "Test 007";
  clearFolder($_, 1e3) for in, out, outFixed, reportFolder;
  createSampleInputFilesFixFolder(in);

  my $x = xref(inputFolder => in,
               reports     => reportFolder,
               fixBadRefs  => 1,
               fixedFolder => outFixed);

  ok $x->statusLine eq q(Xref: 2 refs, 2 second lines);
  my @files = searchDirectoryTreesForMatchingFiles(outFixed, q(dita));

  ok @files == 2;

  ok nws(readFile($files[0])) eq nws(<<END);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE reference PUBLIC "-//PHIL//DTD DITA Task//EN" "concept.dtd" []>
<concept id="c1">
  <title>Concept 1 which refers to concept 2</title>
  <conbody>
    <p conref="2.dita#c2/p1"/>
    <p conref="2.dita#c2/p2"/>
    <p xtrf="3.dita#c2/p1"/>
    <xref href="2.dita#c2/p1"/>
    <xref href="2.dita#c2/p2"/>
    <xref xtrf="3.dita#c2/p1"/>
  </conbody>
</concept>
END

#  &writeXrefStructure($x, qw(fixedRefsBad));

  is_deeply checkXrefStructure($x, q(fixedRefsBad)),
   [["No such target", "p",    "conref", "3.dita#c2/p1", "1.dita"],
    ["No such target", "xref", "href",   "3.dita#c2/p1", "1.dita"]];
 }

if (0) {                                                                        # ltgt
lll "Test 008";
  clearFolder($_, 1e3) for in, reports;
  createSampleInputFilesLtGt(in);

  my $x = xref(inputFolder => in, reports => reportFolder);
  my $r = readFile(fpe($x->reports, qw(count ltgt txt)));
  ok $r =~ m(1\\s*1\\s*aaa);
  ok $r =~ m(2\\s*1\\s*bbb);
 }

if (1) {                                                                        # fixDitaRefs using target files to locate flattened files
lll "Test 009";
  clearFolder(tests, 111);
  createSampleInputFilesForFixDitaRefsImproved1(tests);

  my $x = xref                                                                  # Fix with statistics showing the scale of the problem
   (inputFolder  => out,
    reports      => reportFolder,
    fixBadRefs   => 1,
    fixDitaRefs  => targets,
    fixedFolder  => outFixed,
    );

  ok !$x->errors;

  is_deeply checkXrefStructure($x, q(inputFileToTargetTopics), tests),
   {"in/a.dita"     => {"c_aaaa_ca202b3f0a58c67675f9704a32546cea.dita" => 1},
    "in/ab.ditamap" => {"bm_4ef751d67c53ac33272c3bbe16284b0d.ditamap"  => 1},
    "in/b.dita"     => {"c_aaaa_ca202b3f0a58c67675f9704a32546cea.dita" => 1}
   };

  is_deeply checkXrefStructure($x, q(originalSourceFileAndIdToNewFile), tests),
   {"in/a.dita"     => {"GUID-1581d732-b13a-edf0-2651-220a78f1c0fa" => "c_aaaa_ca202b3f0a58c67675f9704a32546cea.dita"},
    "in/ab.ditamap" => {"GUID-18c89db5-781b-666a-f24a-fbafa6d70733" => "bm_4ef751d67c53ac33272c3bbe16284b0d.ditamap"},
    "in/b.dita"     => {"GUID-1581d732-b13a-edf0-2651-220a78f1c0fa" => "c_aaaa_ca202b3f0a58c67675f9704a32546cea.dita"}
   };

  is_deeply checkXrefStructure($x, q(targetTopicToInputFiles), tests),
   {"bm_4ef751d67c53ac33272c3bbe16284b0d.ditamap"  => {"in/ab.ditamap" => 1},
    "c_aaaa_ca202b3f0a58c67675f9704a32546cea.dita" => {"in/a.dita" => 1, "in/b.dita" => 1}
   };

  my  $y = xref(inputFolder => outFixed, reports => reportFolder);              # Check results
  ok !$y->errors;
 }

if (1) {                                                                        # fixDitaRefs using target files to resolve conrefs to renamed files
lll "Test 010";
  clearFolder(tests, 111);
  createSampleInputFilesForFixDitaRefsImproved2(tests);

  my $y = xref(inputFolder => out, reports => reportFolder);                    # Check results without fixes
  ok $y->statusLine eq q(Xref: 1 ref);

  my $x = xref
   (inputFolder => out,
    reports     => reportFolder,
    fixBadRefs  => 1,
    fixDitaRefs => targets,
    fixedFolder => outFixed);

  ok !$x->errors;

  is_deeply checkXrefStructure($x, q(inputFileToTargetTopics), tests),
   {"in/a.dita" => {"c_aaaa_c8e30fbb422819ab92e1752ca50bb158.dita"=>1},
    "in/b.dita" => {"c_bbbb_e374c26206dc955160cecea10306509d.dita"=>1}
   };

  is_deeply checkXrefStructure($x, q(originalSourceFileAndIdToNewFile),tests),
   {"in/a.dita" => {"GUID-48fb251a-9a88-3bcc-d81b-301f426ed439" => "c_aaaa_c8e30fbb422819ab92e1752ca50bb158.dita"},
    "in/b.dita" => {"GUID-e9997c20-3dcf-6958-f762-09d8250bc53e" => "c_bbbb_e374c26206dc955160cecea10306509d.dita",
                    "p1"                                        => "c_bbbb_e374c26206dc955160cecea10306509d.dita"}
   };

  is_deeply checkXrefStructure($x, q(targetTopicToInputFiles), tests),
   {"c_aaaa_c8e30fbb422819ab92e1752ca50bb158.dita" => {"in/a.dita" => 1},
    "c_bbbb_e374c26206dc955160cecea10306509d.dita" => {"in/b.dita" => 1}
   };
 }

if (1) {                                                                        #Txref fixDitaRefs in bookmaps to topics that were cut into multiple pieces
lll "Test 011";
  clearFolder(tests, 111);
  createSampleInputFilesForFixDitaRefsImproved3(tests);

  my $y = xref(inputFolder => out, reports => reportFolder);                    # Check results without fixes
  ok $y->statusLine eq q(Xref: 1 ref);

  my $x = xref
   (inputFolder => out,
    reports     => reportFolder,
    fixBadRefs  => 1,
    fixDitaRefs => targets,
    fixedFolder => outFixed);

  ok !$x->errors;
 }

if (1) {                                                                        # fixDitaRefs in bookmaps to a topics that was not cut into multiple pieces
lll "Test 012";
  clearFolder(tests, 111);
  createSampleInputFilesForFixDitaRefsImproved4(tests);

  my $y = xref(inputFolder => out, reports => reportFolder);                    # Check results without fixes
  ok $y->statusLine eq q(Xref: 1 ref);

  my $x = xref
   (inputFolder => out,
    reports     => reportFolder,
    fixBadRefs  => 1,
    fixDitaRefs => targets,
    fixedFolder => outFixed);

  ok !$x->errors;

  ok int(1e2 * $y->tagsTextsRatio) == 233;
 }

if (1) {                                                                        # Images
lll "Test 013";
  clearFolder(tests, 111);
  createSampleImageTest(tests);

  my $x = xref
   (inputFolder => out,
    reports     => reportFolder,
    fixBadRefs  => 1,
    fixDitaRefs => targets,
    fixedFolder => outFixed);

  ok $x->statusLine eq q(Xref: 1 image ref, 1 ref);

  my ($file) = keys $x->missingImageFiles->%*;
  ok $file && $file =~ m(/images/b.png\\Z);
 }

if (1) {                                                                        # Test topic flattening ratio reporting
lll "Test 014";
  clearFolder(tests, 111);
  createTestTopicFlattening(tests);

  my $x = xref
   (inputFolder => out,
    reports     => reportFolder,
    fixBadRefs  => 1,
    fixDitaRefs => targets,
    fixedFolder => outFixed);

  ok $x->topicsFlattened       == 3;
  ok $x->topicFlatteningFactor == 3;

  is_deeply checkXrefStructure($x, q(topicFlattening), in, targets),
   { "c_2b1faeb8f74e670e20450cde864e2e46.dita" =>
     [ "c1.dita", "c2.dita", "c3.dita", ],
   };
 }

#latestTest:;
if (1) {                                                                        # References to flattened files
lll "Test 016";
  clearFolder(tests, 111);
  createTestReferencedToFlattenedTopic(tests);

  my $x = xref(inputFolder => out, reports => reportFolder);
  ok $x->statusLine eq q(Xref: 1 ref);
  is_deeply checkXrefStructure($x, q(fixedRefsGood), in, targets), [];

  my $y = xref
   (inputFolder => out,
    reports     => reportFolder,
    fixBadRefs  => 1,
    fixDitaRefs => targets,
    fixedFolder => outFixed);

  ok $y->topicsFlattened == 2;
  ok $y->topicFlatteningFactor == 2;

  is_deeply checkXrefStructure($y, q(fixedRefsGood), in, targets),
   [["Unique target for file ref", "p", "conref", "b.dita#c/p1",
     "c_aaaa_8b028dc2faaca88ac747b3776189d4a6.dita",
     "c_aaaa_3119ee09e34375ed4d8a7a15274a9774.dita", "a.dita"]];

  ok !$y->errors;
  is_deeply checkXrefStructure($y, q(fixedRefsGood), in, targets),
    [["Unique target for file ref", "p", "conref", "b.dita#c/p1",
      "c_aaaa_8b028dc2faaca88ac747b3776189d4a6.dita",
      "c_aaaa_3119ee09e34375ed4d8a7a15274a9774.dita", "a.dita"]];

 }

#latestTest:;
if (1) {                                                                        # References from a topic that has been cut out to a topic that has been cut out
lll "Test 017";
  clearFolder(tests, 111);
  createTestReferenceToCutOutTopic(tests);

  my $x = xref
   (inputFolder => out,
    reports     => reportFolder,
    fixBadRefs  => 1,
    fixDitaRefs => targets,
    fixedFolder => outFixed);

  ok $x->statusLine eq q(Xref: 1 ref);

  is_deeply checkXrefStructure($x, q(inputFileToTargetTopics),          in, targets), { "a.xml" => { "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita" => 1, "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => 1, "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => 1, "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => 1, }, "b.xml" => { "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita" => 1, "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => 1, "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => 1, "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => 1, }, };
  is_deeply checkXrefStructure($x, q(targetTopicToInputFiles),          in, targets), { "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita" => { "a.xml" => 1, }, "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { "a.xml" => 1, }, "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { "a.xml" => 1, }, "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { "a.xml" => 1, }, "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita" => { "b.xml" => 1, }, "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => { "b.xml" => 1, }, "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => { "b.xml" => 1, }, "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => { "b.xml" => 1, }, };
  is_deeply checkXrefStructure($x, q(sourceTopicToTargetBookMap),       in, targets), { "a.xml" => bless({ source => "a.xml", sourceDocType => "concept", target => "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap", targetType => "bookmap", }, "Bookmap"), "b.xml" => bless({ source => "b.xml", sourceDocType => "concept", target => "bm_b_d2806ba589f908da1106574afd9db642.ditamap", targetType => "bookmap", }, "Bookmap"), };
  is_deeply checkXrefStructure($x, q(topicFlattening),                  in, targets), {};
  is_deeply checkXrefStructure($x, q(originalSourceFileAndIdToNewFile), in, targets), { "a.xml" => { "GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf" => "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita", "GUID-68822563-d568-f418-38ae-f1c62cb4ac8d" => "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita", "GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368" => "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita", "GUID-f0c0e170-8128-10ef-045d-97602fdde76f" => "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita", }, "b.xml" => { "GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd" => "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita", "GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc" => "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita", "GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251" => "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita", "GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7" => "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita", "p1" => "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita", "p2" => "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita", "p3" => "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita", }, };

  #dumpFile(q(/home/phil/z/xref.data), deleteVariableFields($x)); exit;
  is_deeply deleteVariableFields($x), do {
do {
  my $a = bless({
    addNavTitles                         => undef,
    allowUniquePartialMatches            => undef,
    attributeCount                       => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => { href => 4, id => 1, navtitle => 4, product => 1, version => 1 },
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => { href => 4, id => 1, navtitle => 4, product => 1, version => 1 },
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => { id => 1 },
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { conref => 1, id => 1 },
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { conref => 1, id => 1 },
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { conref => 1, id => 1 },
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => { id => 2 },
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => { id => 1 },
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => { id => 2 },
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => { id => 2 },
                                            },
    attributeNamesAndValuesCount         => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => {
                                                                                                       href => {
                                                                                                         "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => 1,
                                                                                                         "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => 1,
                                                                                                         "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => 1,
                                                                                                         "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => 1,
                                                                                                       },
                                                                                                       id => { "GUID-80a6bceb-0817-2a54-4d9e-ea67eed112b3" => 1 },
                                                                                                       navtitle => { "aaaa" => 1, "aaaa bbbb" => 1, "aaaa cccc" => 1, "aaaa dddd" => 1 },
                                                                                                     },
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => {
                                                                                                       href => {
                                                                                                         "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => 1,
                                                                                                         "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => 1,
                                                                                                         "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => 1,
                                                                                                         "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => 1,
                                                                                                       },
                                                                                                       id => { "GUID-21696006-94ec-4e53-78c5-24a93641a474" => 1 },
                                                                                                       navtitle => { "bbbb" => 1, "bbbb aaaa" => 1, "bbbb bbbb" => 1, "bbbb cccc" => 1 },
                                                                                                     },
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => { id => { "GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368" => 1 } },
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => {
                                                                                                       conref => { p1 => 1 },
                                                                                                       id => { "GUID-f0c0e170-8128-10ef-045d-97602fdde76f" => 1 },
                                                                                                     },
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => {
                                                                                                       conref => { p2 => 1 },
                                                                                                       id => { "GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf" => 1 },
                                                                                                     },
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => {
                                                                                                       conref => { p3 => 1 },
                                                                                                       id => { "GUID-68822563-d568-f418-38ae-f1c62cb4ac8d" => 1 },
                                                                                                     },
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => {
                                                                                                       id => { "GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251" => 1, "p1" => 1 },
                                                                                                     },
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => { id => { "GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc" => 1 } },
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => {
                                                                                                       id => { "GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7" => 1, "p2" => 1 },
                                                                                                     },
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => {
                                                                                                       id => { "GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd" => 1, "p3" => 1 },
                                                                                                     },
                                            },
    author                               => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap" => "",
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap" => "",
                                            },
    badGuidHrefs                         => {},
    badNavTitles                         => {},
    badReferencesCount                   => 3,
    badTables                            => [],
    badXml1                              => {},
    badXml2                              => {},
    baseFiles                            => {},
    baseTag                              => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => "bookmap",
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => "bookmap",
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => "concept",
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => "concept",
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => "concept",
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => "concept",
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => "concept",
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => "concept",
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => "concept",
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => "concept",
                                            },
    bookMapRefs                          => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap" => {
                                                                                                   "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => { aaaa => 1 },
                                                                                                   "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { "aaaa bbbb" => 1 },
                                                                                                   "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { "aaaa cccc" => 1 },
                                                                                                   "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { "aaaa dddd" => 1 },
                                                                                                 },
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap" => {
                                                                                                   "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => { bbbb => 1 },
                                                                                                   "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => { "bbbb aaaa" => 1 },
                                                                                                   "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => { "bbbb bbbb" => 1 },
                                                                                                   "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => { "bbbb cccc" => 1 },
                                                                                                 },
                                            },
    changeBadXrefToPh                    => undef,
    classificationMaps                   => undef,
    conRefs                              => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => {},
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => {},
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { p1 => { p => 1 } },
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { p2 => { p => 1 } },
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { p3 => { p => 1 } },
                                            },
    createReports1                       => [
                                              "reportXml1",
                                              "reportXml2",
                                              "reportDuplicateIds",
                                              "reportDuplicateTopicIds",
                                              "reportNoHrefs",
                                              "reportTables",
                                              "reportParseFailed",
                                              "reportAttributeCount",
                                              "reportLtGt",
                                              "reportTagCount",
                                              "reportTagsAndTextsCount",
                                              "reportDocTypeCount",
                                              "reportFileExtensionCount",
                                              "reportFileTypes",
                                              "reportValidationErrors",
                                              "reportGuidHrefs",
                                              "reportExternalXrefs",
                                              "reportTopicDetails",
                                              "reportTopicReuse",
                                              "reportMd5Sum",
                                              "reportOlBody",
                                              "reportHrefUrlEncoding",
                                              "reportFixRefs",
                                              "reportSourceFiles",
                                              "reportOtherMeta",
                                              "createSubjectSchemeMap",
                                              "reportTopicsNotReferencedFromBookMaps",
                                              "reportTableDimensions",
                                              "reportExteriorMaps",
                                              "createClassificationMaps",
                                              "reportIdRefs",
                                              "reportEmptyTopics",
                                              "reportConRefMatching",
                                              "reportPublicIds",
                                              "reportRequiredCleanUps",
                                            ],
    createReports2                       => ["removeUnusedIds", "reportImages"],
    currentFolder                        => "",
    deguidize                            => undef,
    deleteUnusedIds                      => 0,
    docType                              => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => "bookmap",
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => "bookmap",
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => "concept",
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => "concept",
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => "concept",
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => "concept",
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => "concept",
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => "concept",
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => "concept",
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => "concept",
                                            },
    duplicateIds                         => {},
    duplicateTopicIds                    => {},
    emptyTopics                          => {
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => 1,
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => 1,
                                            },
    errors                               => 1,
    exteriorMaps                         => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap" => 1,
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap" => 1,
                                            },
    fileExtensions                       => [".dita", ".ditamap", ".xml", ".fodt"],
    fixBadRefs                           => 1,
    fixDitaRefs                          => "targets",
    fixedFolder                          => "",
    fixedFolderTemp                      => "",
    fixedRefsBad                         => [
                                              [
                                                "No such target",
                                                "p",
                                                "conref",
                                                "p2",
                                                "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita",
                                                "a.xml",
                                              ],
                                            ],
    fixedRefsGB                          => [],
    fixedRefsGood                        => [
                                              [
                                                "Unique target for file ref",
                                                "p",
                                                "conref",
                                                "p1",
                                                "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita",
                                                "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita",
                                                "a.xml",
                                              ],
                                              [
                                                "Unique target for file ref",
                                                "p",
                                                "conref",
                                                "p3",
                                                "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita",
                                                "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita",
                                                "a.xml",
                                              ],
                                            ],
    fixedRefsNoAction                    => [],
    fixRefs                              => {
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { p1 => 1 },
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { p2 => 1 },
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { p3 => 1 },
                                            },
    fixRelocatedRefs                     => undef,
    fixXrefsByTitle                      => undef,
    flattenFiles                         => {},
    flattenFolder                        => undef,
    getFileUrl                           => "client.pl?getFile=",
    goodImageFiles                       => {},
    goodNavTitles                        => {},
    guidHrefs                            => {},
    guidToFile                           => {},
    hrefUrlEncoding                      => {},
    html                                 => undef,
    idNotReferenced                      => {
                                              "b.xml" => {},
                                              "bb.xml" => {},
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap" => { "GUID-80a6bceb-0817-2a54-4d9e-ea67eed112b3" => 1 },
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap" => { "GUID-21696006-94ec-4e53-78c5-24a93641a474" => 1 },
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita" => { "GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368" => 1 },
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { "GUID-f0c0e170-8128-10ef-045d-97602fdde76f" => 1 },
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { "GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf" => 1 },
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { "GUID-68822563-d568-f418-38ae-f1c62cb4ac8d" => 1 },
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita" => { "GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251" => 1, "p1" => 1 },
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => { "GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc" => 1 },
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => { "GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7" => 1, "p2" => 1 },
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => { "GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd" => 1, "p3" => 1 },
                                            },
    idReferencedCount                    => { "b.xml" => { p1 => 1, p3 => 1 }, "bb.xml" => { p2 => 1 } },
    ids                                  => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => { "GUID-80a6bceb-0817-2a54-4d9e-ea67eed112b3" => 1 },
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => { "GUID-21696006-94ec-4e53-78c5-24a93641a474" => 1 },
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => { "GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368" => 1 },
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { "GUID-f0c0e170-8128-10ef-045d-97602fdde76f" => 1 },
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { "GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf" => 1 },
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { "GUID-68822563-d568-f418-38ae-f1c62cb4ac8d" => 1 },
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => { "GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251" => 1, "p1" => 1 },
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => { "GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc" => 1 },
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => { "GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7" => 1, "p2" => 1 },
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => { "GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd" => 1, "p3" => 1 },
                                            },
    idsRemoved                           => {
                                              "GUID-21696006-94ec-4e53-78c5-24a93641a474" => 1,
                                              "GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd" => 1,
                                              "GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf" => 1,
                                              "GUID-68822563-d568-f418-38ae-f1c62cb4ac8d" => 1,
                                              "GUID-80a6bceb-0817-2a54-4d9e-ea67eed112b3" => 1,
                                              "GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc" => 1,
                                              "GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251" => 1,
                                              "GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368" => 1,
                                              "GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7" => 1,
                                              "GUID-f0c0e170-8128-10ef-045d-97602fdde76f" => 1,
                                            },
    idTags                               => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => { "GUID-80a6bceb-0817-2a54-4d9e-ea67eed112b3" => ["bookmap"] },
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => { "GUID-21696006-94ec-4e53-78c5-24a93641a474" => ["bookmap"] },
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => { "GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368" => ["concept"] },
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { "GUID-f0c0e170-8128-10ef-045d-97602fdde76f" => ["concept"] },
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { "GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf" => ["concept"] },
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { "GUID-68822563-d568-f418-38ae-f1c62cb4ac8d" => ["concept"] },
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => {
                                                                                                       "GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251" => ["concept"],
                                                                                                       "p1" => ["p"],
                                                                                                     },
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => { "GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc" => ["concept"] },
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => {
                                                                                                       "GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7" => ["concept"],
                                                                                                       "p2" => ["p"],
                                                                                                     },
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => {
                                                                                                       "GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd" => ["concept"],
                                                                                                       "p3" => ["p"],
                                                                                                     },
                                            },
    images                               => {},
    imagesReferencedFromBookMaps         => {},
    imagesReferencedFromTopics           => {
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => {},
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => {},
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => {},
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => {},
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => {},
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => {},
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => {},
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => {},
                                            },
    imagesToRefferingBookMaps            => {},
    indexedWords                         => {},
    indexWords                           => undef,
    indexWordsFolder                     => undef,
    inputFiles                           => [
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap",
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap",
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita",
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita",
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita",
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita",
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita",
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita",
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita",
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita",
                                            ],
    inputFileToTargetTopics              => {
                                              "a.xml" => {
                                                           "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => 1,
                                                           "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => 1,
                                                           "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => 1,
                                                           "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => 1,
                                                         },
                                              "b.xml" => {
                                                           "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => 1,
                                                           "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => 1,
                                                           "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => 1,
                                                           "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => 1,
                                                         },
                                            },
    inputFolder                          => "",
    inputFolderImages                    => {
                                              bm_a_9d0a9f8e0ac234de9e22c19054b6e455        => "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap",
                                              bm_b_d2806ba589f908da1106574afd9db642        => "bm_b_d2806ba589f908da1106574afd9db642.ditamap",
                                              c_aaaa_121939eab89cd7d2c3eb4c4189772a1f      => "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita",
                                              c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b => "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita",
                                              c_aaaa_cccc_a91633094220d068c453eecae1726eff => "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita",
                                              c_aaaa_dddd_914b8e11993908497768c50d992ea0f0 => "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita",
                                              c_bbbb_6100b51ca1f789836cd4f31893ed67d2      => "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita",
                                              c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d => "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita",
                                              c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b => "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita",
                                              c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3 => "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita",
                                            },
    ltgt                                 => {},
    matchTopics                          => undef,
    maxZoomIn                            => undef,
    maxZoomOut                           => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => {},
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => {},
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => {},
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => {},
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => {},
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => {},
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => {},
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => {},
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => {},
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => {},
                                            },
    md5Sum                               => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => "80a6bceb08172a544d9eea67eed112b3",
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => "2169600694ec4e5378c524a93641a474",
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => "c67821ef3da2c89f0fc99fba3937f368",
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => "f0c0e170812810ef045d97602fdde76f",
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => "400c2c5995e17bf346473a135281bfaf",
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => "68822563d568f41838aef1c62cb4ac8d",
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => "96a20d7fbbafdeef55efe09a0a059251",
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => "86a684b01a0b4c306da924c74ff1f0cc",
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => "cfe7cb3d05e7a147db10dcbacaeecef7",
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => "2b6aab4f9328e326f55f160771a8c3dd",
                                            },
    md5SumDuplicates                     => {},
    missingImageFiles                    => {},
    missingTopicIds                      => {},
    noHref                               => {},
    notReferenced                        => {},
    olBody                               => {},
    originalSourceFileAndIdToNewFile     => {
                                              "a.xml" => {
                                                           "GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf" => "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita",
                                                           "GUID-68822563-d568-f418-38ae-f1c62cb4ac8d" => "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita",
                                                           "GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368" => "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita",
                                                           "GUID-f0c0e170-8128-10ef-045d-97602fdde76f" => "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita",
                                                         },
                                              "b.xml" => {
                                                           "GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd" => "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita",
                                                           "GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc" => "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita",
                                                           "GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251" => "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita",
                                                           "GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7" => "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita",
                                                           "p1" => "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita",
                                                           "p2" => "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita",
                                                           "p3" => "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita",
                                                         },
                                            },
    otherMeta                            => {},
    otherMetaBookMapsAfterTopicIncludes  => [],
    otherMetaBookMapsBeforeTopicIncludes => [],
    otherMetaConsolidated                => {},
    otherMetaDuplicatesCombined          => [],
    otherMetaDuplicatesSeparately        => [],
    otherMetaPushToBookMap               => [],
    otherMetaRemainWithTopic             => [],
    oxygenProjects                       => undef,
    parseFailed                          => {},
    publicId                             => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => "EN",
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => "EN",
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => "EN",
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => "EN",
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => "EN",
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => "EN",
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => "EN",
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => "EN",
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => "EN",
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => "EN",
                                            },
    references                           => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => {
                                                                                                       "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => 1,
                                                                                                       "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => 1,
                                                                                                       "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => 1,
                                                                                                       "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => 1,
                                                                                                     },
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => {
                                                                                                       "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => 1,
                                                                                                       "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => 1,
                                                                                                       "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => 1,
                                                                                                       "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => 1,
                                                                                                     },
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { p1 => 1 },
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { p2 => 1 },
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { p3 => 1 },
                                            },
    relocatedReferencesFailed            => [],
    relocatedReferencesFixed             => [],
    reports                              => \'\',
    requestAttributeNameAndValueCounts   => undef,
    requiredCleanUp                      => {},
    results                              => [[1, "ref"]],
    sourceTopicToTargetBookMap           => {
                                              "a.xml" => bless({
                                                           source => "a.xml",
                                                           sourceDocType => "concept",
                                                           target => "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap",
                                                           targetType => "bookmap",
                                                         }, "Bookmap"),
                                              "b.xml" => bless({
                                                           source => "b.xml",
                                                           sourceDocType => "concept",
                                                           target => "bm_b_d2806ba589f908da1106574afd9db642.ditamap",
                                                           targetType => "bookmap",
                                                         }, "Bookmap"),
                                            },
    statusLine                           => "Xref: 1 ref",
    statusTable                          => "   Count  Condition\\n1      1  ref\\n",
    subjectSchemeMap                     => undef,
    suppressReferenceChecks              => undef,
    tableDimensions                      => {},
    tagCount                             => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => {
                                                                                                       appendices        => 1,
                                                                                                       approved          => 1,
                                                                                                       author            => 1,
                                                                                                       bookchangehistory => 1,
                                                                                                       booklists         => 1,
                                                                                                       bookmap           => 1,
                                                                                                       bookmeta          => 1,
                                                                                                       bookowner         => 1,
                                                                                                       bookrights        => 1,
                                                                                                       booktitle         => 1,
                                                                                                       brand             => 1,
                                                                                                       category          => 1,
                                                                                                       CDATA             => 1,
                                                                                                       chapter           => 1,
                                                                                                       copyrfirst        => 1,
                                                                                                       frontmatter       => 1,
                                                                                                       keyword           => 1,
                                                                                                       keywords          => 1,
                                                                                                       mainbooktitle     => 1,
                                                                                                       notices           => 1,
                                                                                                       preface           => 1,
                                                                                                       prodinfo          => 1,
                                                                                                       prodname          => 1,
                                                                                                       prognum           => 1,
                                                                                                       relcell           => 4,
                                                                                                       relcolspec        => 2,
                                                                                                       relheader         => 1,
                                                                                                       relrow            => 2,
                                                                                                       reltable          => 1,
                                                                                                       revisionid        => 1,
                                                                                                       shortdesc         => 1,
                                                                                                       source            => 1,
                                                                                                       toc               => 1,
                                                                                                       topicref          => 3,
                                                                                                       vrm               => 1,
                                                                                                       vrmlist           => 1,
                                                                                                       year              => 1,
                                                                                                     },
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => {
                                                                                                       appendices        => 1,
                                                                                                       approved          => 1,
                                                                                                       author            => 1,
                                                                                                       bookchangehistory => 1,
                                                                                                       booklists         => 1,
                                                                                                       bookmap           => 1,
                                                                                                       bookmeta          => 1,
                                                                                                       bookowner         => 1,
                                                                                                       bookrights        => 1,
                                                                                                       booktitle         => 1,
                                                                                                       brand             => 1,
                                                                                                       category          => 1,
                                                                                                       CDATA             => 1,
                                                                                                       chapter           => 1,
                                                                                                       copyrfirst        => 1,
                                                                                                       frontmatter       => 1,
                                                                                                       keyword           => 1,
                                                                                                       keywords          => 1,
                                                                                                       mainbooktitle     => 1,
                                                                                                       notices           => 1,
                                                                                                       preface           => 1,
                                                                                                       prodinfo          => 1,
                                                                                                       prodname          => 1,
                                                                                                       prognum           => 1,
                                                                                                       relcell           => 4,
                                                                                                       relcolspec        => 2,
                                                                                                       relheader         => 1,
                                                                                                       relrow            => 2,
                                                                                                       reltable          => 1,
                                                                                                       revisionid        => 1,
                                                                                                       shortdesc         => 1,
                                                                                                       source            => 1,
                                                                                                       toc               => 1,
                                                                                                       topicref          => 3,
                                                                                                       vrm               => 1,
                                                                                                       vrmlist           => 1,
                                                                                                       year              => 1,
                                                                                                     },
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => { CDATA => 1, conbody => 1, concept => 1, title => 1 },
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { CDATA => 1, conbody => 1, concept => 1, p => 1, title => 1 },
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { CDATA => 1, conbody => 1, concept => 1, p => 1, title => 1 },
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { CDATA => 1, conbody => 1, concept => 1, p => 1, title => 1 },
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => { CDATA => 2, conbody => 1, concept => 1, p => 1, title => 1 },
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => { CDATA => 1, conbody => 1, concept => 1, title => 1 },
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => { CDATA => 2, conbody => 1, concept => 1, p => 1, title => 1 },
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => { CDATA => 2, conbody => 1, concept => 1, p => 1, title => 1 },
                                            },
    tags                                 => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => 43,
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => 43,
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => 3,
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => 4,
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => 4,
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => 4,
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => 4,
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => 3,
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => 4,
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => 4,
                                            },
    targetFolderContent                  => {
                                              "a.xml" => "bless({\\n  source => \\"a.xml\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap\\",\\n  targetType => \\"bookmap\\",\\n}, \\"SourceToTarget\\")",
                                              "b.xml" => "bless({\\n  source => \\"b.xml\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"bm_b_d2806ba589f908da1106574afd9db642.ditamap\\",\\n  targetType => \\"bookmap\\",\\n}, \\"SourceToTarget\\")",
                                            },
    targetTopicToInputFiles              => {
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => { "a.xml" => 1 },
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { "a.xml" => 1 },
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { "a.xml" => 1 },
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { "a.xml" => 1 },
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => { "b.xml" => 1 },
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => { "b.xml" => 1 },
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => { "b.xml" => 1 },
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => { "b.xml" => 1 },
                                            },
    texts                                => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => 1,
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => 1,
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => 1,
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => 1,
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => 1,
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => 1,
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => 2,
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => 1,
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => 2,
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => 2,
                                            },
    title                                => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => "a",
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => "b",
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => "aaaa",
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => "aaaa bbbb",
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => "aaaa cccc",
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => "aaaa dddd",
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => "bbbb",
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => "bbbb aaaa",
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => "bbbb bbbb",
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => "bbbb cccc",
                                            },
    titleToFile                          => {
                                              "aaaa"      => { "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita" => 1 },
                                              "aaaa bbbb" => { "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => 1 },
                                              "aaaa cccc" => { "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => 1 },
                                              "aaaa dddd" => { "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => 1 },
                                              "bbbb"      => { "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita" => 1 },
                                              "bbbb aaaa" => { "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => 1 },
                                              "bbbb bbbb" => { "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => 1 },
                                              "bbbb cccc" => { "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => 1 },
                                            },
    topicFlattening                      => {},
    topicFlatteningFactor                => 0,
    topicIds                             => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => "GUID-80a6bceb-0817-2a54-4d9e-ea67eed112b3",
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => "GUID-21696006-94ec-4e53-78c5-24a93641a474",
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => "GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368",
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => "GUID-f0c0e170-8128-10ef-045d-97602fdde76f",
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => "GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf",
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => "GUID-68822563-d568-f418-38ae-f1c62cb4ac8d",
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => "GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251",
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => "GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc",
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => "GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7",
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => "GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd",
                                            },
    topicsFlattened                      => 0,
    topicsNotReferencedFromBookMaps      => {},
    topicsReferencedFromBookMaps         => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap" => \'fix\',
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap" => \'fix\',
                                            },
    topicsToReferringBookMaps            => {
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => { "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap" => 1 },
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap" => 1 },
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap" => 1 },
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap" => 1 },
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => { "bm_b_d2806ba589f908da1106574afd9db642.ditamap" => 1 },
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => { "bm_b_d2806ba589f908da1106574afd9db642.ditamap" => 1 },
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => { "bm_b_d2806ba589f908da1106574afd9db642.ditamap" => 1 },
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => { "bm_b_d2806ba589f908da1106574afd9db642.ditamap" => 1 },
                                            },
    urls                                 => {},
    urlsBad                              => {},
    urlsGood                             => {},
    validateUrls                         => undef,
    validationErrors                     => {},
    vocabulary                           => {},
    xrefBadFormat                        => {},
    xrefBadScope                         => {},
    xRefs                                => {},
    xrefsFixedByTitle                    => [],
  }, "Data::Edit::Xml::Xref");
  $a->{topicsReferencedFromBookMaps}{"bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"} = $a->{inputFileToTargetTopics}{"a.xml"};
  $a->{topicsReferencedFromBookMaps}{"bm_b_d2806ba589f908da1106574afd9db642.ditamap"} = $a->{inputFileToTargetTopics}{"b.xml"};
  $a;
}};
 }

#latestTest:;
if (1) {                                                                        # Othermeta migration
lll "Test 018";
  clearFolder(tests, 111);
  createSampleOtherMeta(in);

  my $x = xref(inputFolder      => in,
               reports          => reportFolder,
               subjectSchemeMap => fpe(out, qw(subjectScheme map)));

  ok !$x->errors;

  is_deeply checkXrefStructure($x, q(otherMetaDuplicatesSeparately)), [];

  is_deeply checkXrefStructure($x, q(otherMetaDuplicatesCombined)),
   [["b1.ditamap", "dd", 2, "DD"], ["", "", "", "DD1111"],
    ["b2.ditamap", "dd", 2, "DD"], ["", "", "", "DD2222"]];

  is_deeply checkXrefStructure($x, q(otherMetaRemainWithTopic)),
   [[ "ca.dita", "dd", "DD", "b1.ditamap", "b2.ditamap"],
    [ "cb.dita", "dd", "DD", "b1.ditamap", "b2.ditamap"]];

  is_deeply checkXrefStructure($x, q(otherMetaPushToBookMap)),
   [[ "ca.dita", "aa", "AAAA", "b1.ditamap"],
    [ "ca.dita", "aa", "AAAA", "b2.ditamap"],
    [ "ca.dita", "bb", "BBBB", "b1.ditamap"],
    [ "ca.dita", "bb", "BBBB", "b2.ditamap"],
    [ "cb.dita", "aa", "AAAA", "b1.ditamap"],
    [ "cb.dita", "aa", "AAAA", "b2.ditamap"],
    [ "cb.dita", "bb", "BBBB", "b1.ditamap"],
    [ "cb.dita", "bb", "BBBB", "b2.ditamap"]];

  is_deeply checkXrefStructure($x, q(otherMetaBookMapsBeforeTopicIncludes)),
   [["b1.ditamap", "aa", 1, "AAAA"],
    ["b1.ditamap", "bb", 1, "BBBB"],
    ["b1.ditamap", "dd", 1, "DD1111"],
    ["b2.ditamap", "aa", 1, "AAAA"],
    ["b2.ditamap", "bb", 1, "BBBB"],
    ["b2.ditamap", "dd", 1, "DD2222"]];

  is_deeply checkXrefStructure($x, q(otherMetaBookMapsAfterTopicIncludes)),
   [["b1.ditamap", "aa", 1, "AAAA"],
    ["b1.ditamap", "bb", 1, "BBBB"],
    ["b1.ditamap", "dd", 2, "DD"],
    ["b1.ditamap", "dd", 2, "DD1111"],
    ["b2.ditamap", "aa", 1, "AAAA"],
    ["b2.ditamap", "bb", 1, "BBBB"],
    ["b2.ditamap", "dd", 2, "DD"],
    ["b2.ditamap", "dd", 2, "DD2222"]];
 }

#latestTest:;
if (1) {                                                                        # Othermeta migration
lll "Test 019";
  clearFolder(tests, 111);
  createTestOneNotRef(tests);

  my $x = xref(inputFolder => in, reports => reportFolder);

  ok !$x->errors;

  is_deeply checkXrefStructure($x, q(topicsNotReferencedFromBookMaps)),
            {"b.dita" => 1};
  is_deeply checkXrefStructure($x, q(topicsReferencedFromBookMaps)),
            {"a.ditamap" => {"a.dita" => 1}};
 }

#latestTest:;
if (1) {                                                                        # Classification and subject scheme maps
lll "Test 020";
  clearFolder(tests, 111);
  createClassificationMapsTest(in);

  my $x = xref
   (inputFolder        => in,
    reports            => reportFolder,
    classificationMaps => 1,
    subjectSchemeMap   => fpe(reportFolder, qw(subjectSchemeAndClassification ditamap)));

  ok !$x->errors;
  my $m1 = fpe(in, qw(maps m1_classification ditamap));
  my $m2 = fpe(in, qw(maps m2_classification ditamap));
  ok -e $_ for $m1, $m2;
  ok readFile($m1) =~ m\'<topicref href="m2_classification.ditamap">\'i;
 }

#latestTest:;
if (1) {                                                                        # Classification and subject scheme maps
lll "Test 021";
  clearFolder(tests, 111);
  createWordsToFilesTest(in);

  my $x = xref(inputFolder      => in,
               reports          => reportFolder,
               indexWords       => 1,
               indexWordsFolder => fpd(reportFolder, q(words)));
  ok  65 == $x->indexedWords;

  my $wt = fpe($x->indexWordsFolder, qw(words_to_topics data));
  my $tw = fpe($x->indexWordsFolder, qw(topics_to_words data));

  ok -e $wt;
  ok -e $tw;

  my $index = retrieve $wt;
  my $i     = intersectionOfHashesAsArrays(map {$index->{$_}} qw(make tea));

  is_deeply removeFilePathsFromStructure($i), { "tea.dita" => [2, 5] };
 }

#latestTest:;
if (1) {                                                                        # Classification and subject scheme maps
lll "Test 022";
  clearFolder(tests, 111);
  createSampleConRefs(&in);

  my $x = xref
   (inputFolder      => in,
    reports          => reportFolder,
    fixBadRefs       => 1,
    fixRelocatedRefs => 1,
    fixXrefsByTitle  => 1,
    fixedFolder      => outFixed,
   );

  is_deeply removeFilePathsFromStructure($x->ids),
   { "c1.dita" => { c1 => 2, i1 => 1, i2 => 2, x1 => 1 },
     "c2.dita" => { c2 => 2, p1 => 1, p2 => 1 },
   };

  is_deeply removeFilePathsFromStructure($x->references),
   { "c1.dita" => { "i1" => 1, "i2" => 1, "i3" => 3, "p1" => 1, "p2" => 1, "p3" => 1, },
   };

  is_deeply removeFilePathsFromStructure($x->idNotReferenced),
   { "c1.dita" => { c1 => 1, x1 => 1 },
     "c2.dita" => { c2 => 1 },
   };

  is_deeply removeFilePathsFromStructure($x->idReferencedCount),
   { "c1.dita" => { i1 => 1, i2 => 1, i3 => 3 },
     "c2.dita" => { p1 => 1, p2 => 1, p3 => 1 },
   };

  ok $x->statusLine eq q(Xref: 5 refs, 3 duplicate ids, 2 first lines, 2 second lines);

  my $fr = readFile(fpe(reportFolder, qw(bad failing_references txt)));
  ok index($fr, q(Comma_Separated_Values_of_column_Reference: "c1.dita#c1/i2","c1.dita#c1/i3","c2.dita#c2/p3")) > -1;
  ok index($fr, q(Comma_Separated_Values_of_column_Attr: "conref","href"))                                      > -1;

  my $di = readFile(fpe(reportFolder, qw(bad duplicateIds txt)));
  ok index($di, q(Comma_Separated_Values_of_column_Id: "c1","c2","i2")) > -1;
  ok index($di, q(Comma_Separated_Values_of_column_Count: 2))           > -1;
 }

#latestTest:;
if (1) {                                                                         # Classification and subject scheme maps
lll "Test 023";
  clearFolder(tests, 111);
  createEmptyBody(&in);

  my $x = xref(inputFolder => in, reports => reportFolder);

  ok !$x->errors;

  #say STDERR writeStructureTest($x->emptyTopics, q($x->emptyTopics));
  is_deeply removeFilePathsFromStructure($x->emptyTopics),
   {"c1.dita" => 1};
 }

#latestTest:;
if (1) {                                                                        # Topics to referring bookmaps
lll "Test 024";
  clearFolder(tests, 111);
  createSampleTopicsReferencedFromBookMaps(&in);

  my $x = xref(inputFolder => in, reports => reportFolder);

  ok $x->statusLine eq q(Xref: 6 refs, 5 first lines, 5 second lines, 3 image refs);

  is_deeply removeFilePathsFromStructure($x->topicsToReferringBookMaps),
   { "c1.dita" => { "m1.dita" => 1, "m2.dita" => 1, },
     "c2.dita" => { "m2.dita" => 1, },
   };

  is_deeply removeFilePathsFromStructure($x->topicsReferencedFromBookMaps),
   { "m1.dita" => { "c1.dita" => 1, },
     "m2.dita" => { "c1.dita" => 1, "c2.dita" => 1, },
   };

  is_deeply removeFilePathsFromStructure($x->imagesToRefferingBookMaps),
   { "1.png" => { "m1.dita" => 1, "m2.dita" => 2, },
     "2.png" => { "m2.dita" => 1, },
     };

  is_deeply removeFilePathsFromStructure($x->imagesReferencedFromBookMaps),
   { "m1.dita" => { "1.png" => 1, },
     "m2.dita" => { "1.png" => 2, "2.png" => 1, },
   };
 }

#latestTest:;
if (1) {                                                                        # Conref matching
lll "Test 025";
  clearFolder(tests, 111);
  createSampleConRefMatching(&in);

  my $x = xref(inputFolder => in, reports => reportFolder);
  ok $x->statusLine eq q(Xref: 2 first lines, 2 second lines);
 }

#latestTest:;
if (1) {                                                                        # Md5 sum duplicates
lll "Test 026";
  clearFolder(tests, 111);
  createSampleDuplicateMd5Sum(&in);

  my $x = xref(inputFolder => in, reports => reportFolder, html => reportFolder);
  ok $x->statusLine eq q(Xref: 5 duplicate files, 5 first lines, 5 missing topic ids, 5 second lines);

  #say STDERR writeStructureTest($x->md5SumDuplicates, q($x->md5SumDuplicates));
  is_deeply removeFilePathsFromStructure($x->md5SumDuplicates),
   { "3b6840b4a7409ae6b0f6daed9aa8f1db" => { "t.dita" => 1, "t.dita" => 1, },
     "a5899fda929f90ff7a2419fc61d5f8c3" => { "c.dita" => 1, "c.dita" => 1, "c.dita" => 1, },
   };
 }

#latestTest:;
if (1) {                                                                        # Remove unreferenced ids
lll "Test 027";
  clearFolder(tests, 111);
  createSampleUnreferencedIds(&in);

  my $x = xref(inputFolder => in, reports => reportFolder, deleteUnusedIds => 1);
  ok $x->statusLine eq q(Xref: 4 duplicate ids, 2 first lines, 2 second lines, 1 ref);
  is_deeply $x->idsRemoved, {c1=>1, c2=>1, p3=>1};

  ok readFile(fpe(&in, qw(c1 dita))) eq <<END;
<concept id="c1">
  <title/>
  <conbody>
    <p id="p1"/>
    <p id="p2"/>
    <p id="p2"/>
    <p/>
    <p/>
    <p/>
  </conbody>
</concept>
END

  ok readFile(fpe(&in, qw(c2 dita))) eq <<END;
<concept id="c2">
  <title/>
  <conbody>
    <p href="c1.dita#p1"/>
    <p conref="c1.dita#c1/p2"/>
  </conbody>
</concept>
END

  my $y = xref(inputFolder => in, reports => reportFolder, html=>reportFolder);
  ok $y->statusLine eq q(Xref: 2 first lines, 2 second lines, 1 duplicate id, 1 ref);

  #say STDERR writeStructureTest($y->duplicateIds, q($y->duplicateIds));
  is_deeply removeFilePathsFromStructure($y->duplicateIds),
   { "c1.dita" => { p2 => 2 },
   };

  ok readFile(fpe(reportFolder, qw(index_of_reports html))) =~ m(<b>31</b> reports available);
 }

#latestTest:;
if (1) {                                                                        # Remove unreferenced ids
lll "Test 028";
  clearFolder(tests, 111);
  createSampleImageReferences(&in);

  my $x = xref(inputFolder => in, reports => reportFolder);
  ok $x->statusLine eq q(Xref: 6 refs, 3 first lines, 3 second lines, 1 image ref);

  #say STDERR writeStructureTest($x->goodImageFiles, q($x->goodImageFiles));
  is_deeply removeFilePathsFromStructure($x->goodImageFiles),
   { "good1.png" => 3, "good2.png" => 3};

  #say STDERR writeStructureTest($x->missingImageFiles, q($x->missingImageFiles));
  is_deeply removeFilePathsFromStructure($x->missingImageFiles),
   { "bad1.png" => 6, };
 }

#latestTest:;
if (1) {                                                                        # Required clean ups report
lll "Test 029";
  clearFolder(tests, 111);
  createRequiredCleanUps(&in);

  my $x = xref(inputFolder => in, reports => reportFolder);
  ok $x->statusLine eq q(Xref: 2 first lines, 2 second lines);

  #dumpFile(q(/home/phil/z/xref.data), deleteVariableFields($x)); exit;
  is_deeply deleteVariableFields($x),
 {addNavTitles                         => undef,
  allowUniquePartialMatches            => undef,
  attributeCount                       => { "c1.dita" => { id => 1 }, "c2.dita" => { id => 1 } },
  attributeNamesAndValuesCount         => {
                                            "c1.dita" => { id => { c1 => 1 } },
                                            "c2.dita" => { id => { c2 => 1 } },
                                          },
  author                               => {},
  badGuidHrefs                         => {},
  badNavTitles                         => {},
  badReferencesCount                   => 0,
  badTables                            => [],
  badXml1                              => { "c1.dita" => 1, "c2.dita" => 1 },
  badXml2                              => { "c1.dita" => 1, "c2.dita" => 1 },
  baseFiles                            => {},
  baseTag                              => { "c1.dita" => "concept", "c2.dita" => "concept" },
  bookMapRefs                          => {},
  changeBadXrefToPh                    => undef,
  classificationMaps                   => undef,
  conRefs                              => {},
  createReports1                       => [
                                            "reportXml1",
                                            "reportXml2",
                                            "reportDuplicateIds",
                                            "reportDuplicateTopicIds",
                                            "reportNoHrefs",
                                            "reportTables",
                                            "reportParseFailed",
                                            "reportAttributeCount",
                                            "reportLtGt",
                                            "reportTagCount",
                                            "reportTagsAndTextsCount",
                                            "reportDocTypeCount",
                                            "reportFileExtensionCount",
                                            "reportFileTypes",
                                            "reportValidationErrors",
                                            "reportGuidHrefs",
                                            "reportExternalXrefs",
                                            "reportTopicDetails",
                                            "reportTopicReuse",
                                            "reportMd5Sum",
                                            "reportOlBody",
                                            "reportHrefUrlEncoding",
                                            "reportFixRefs",
                                            "reportSourceFiles",
                                            "reportOtherMeta",
                                            "createSubjectSchemeMap",
                                            "reportTopicsNotReferencedFromBookMaps",
                                            "reportTableDimensions",
                                            "reportExteriorMaps",
                                            "createClassificationMaps",
                                            "reportIdRefs",
                                            "reportEmptyTopics",
                                            "reportConRefMatching",
                                            "reportPublicIds",
                                            "reportRequiredCleanUps",
                                          ],
  createReports2                       => ["removeUnusedIds", "reportImages"],
  currentFolder                        => "",
  deguidize                            => undef,
  deleteUnusedIds                      => 0,
  docType                              => { "c1.dita" => "concept", "c2.dita" => "concept" },
  duplicateIds                         => {},
  duplicateTopicIds                    => {},
  emptyTopics                          => {},
  errors                               => 2,
  exteriorMaps                         => {},
  fileExtensions                       => [".dita", ".ditamap", ".xml", ".fodt"],
  fixBadRefs                           => undef,
  fixDitaRefs                          => undef,
  fixedFolder                          => undef,
  fixedFolderTemp                      => "",
  fixedRefsBad                         => [],
  fixedRefsGB                          => [],
  fixedRefsGood                        => [],
  fixedRefsNoAction                    => [],
  fixRefs                              => {},
  fixRelocatedRefs                     => undef,
  fixXrefsByTitle                      => undef,
  flattenFiles                         => {},
  flattenFolder                        => undef,
  getFileUrl                           => "client.pl?getFile=",
  goodImageFiles                       => {},
  goodNavTitles                        => {},
  guidHrefs                            => {},
  guidToFile                           => {},
  hrefUrlEncoding                      => {},
  html                                 => undef,
  idNotReferenced                      => { "c1.dita" => { c1 => 1 }, "c2.dita" => { c2 => 1 } },
  idReferencedCount                    => {},
  ids                                  => { "c1.dita" => { c1 => 1 }, "c2.dita" => { c2 => 1 } },
  idsRemoved                           => { c1 => 1, c2 => 1 },
  idTags                               => {
                                            "c1.dita" => { c1 => ["concept"] },
                                            "c2.dita" => { c2 => ["concept"] },
                                          },
  images                               => {},
  imagesReferencedFromBookMaps         => {},
  imagesReferencedFromTopics           => {},
  imagesToRefferingBookMaps            => {},
  indexedWords                         => {},
  indexWords                           => undef,
  indexWordsFolder                     => undef,
  inputFiles                           => ["c1.dita", "c2.dita"],
  inputFileToTargetTopics              => {},
  inputFolder                          => "",
  inputFolderImages                    => { c1 => "c1.dita", c2 => "c2.dita" },
  ltgt                                 => {},
  matchTopics                          => undef,
  maxZoomIn                            => undef,
  maxZoomOut                           => { "c1.dita" => {}, "c2.dita" => {} },
  md5Sum                               => {
                                            "c1.dita" => "92ab49a6d97f749545ec5dc873f53bdb",
                                            "c2.dita" => "a3df8bdda952294d6a533b7ff4f6faeb",
                                          },
  md5SumDuplicates                     => {},
  missingImageFiles                    => {},
  missingTopicIds                      => {},
  noHref                               => {},
  notReferenced                        => {},
  olBody                               => {},
  originalSourceFileAndIdToNewFile     => {},
  otherMeta                            => {},
  otherMetaBookMapsAfterTopicIncludes  => [],
  otherMetaBookMapsBeforeTopicIncludes => [],
  otherMetaConsolidated                => {},
  otherMetaDuplicatesCombined          => [],
  otherMetaDuplicatesSeparately        => [],
  otherMetaPushToBookMap               => [],
  otherMetaRemainWithTopic             => [],
  oxygenProjects                       => undef,
  parseFailed                          => {},
  publicId                             => { "c1.dita" => undef, "c2.dita" => undef },
  references                           => {},
  relocatedReferencesFailed            => [],
  relocatedReferencesFixed             => [],
  reports                              => \'\',
  requestAttributeNameAndValueCounts   => undef,
  requiredCleanUp                      => {
                                            "c1.dita" => { aaa => 1, bbb => 2 },
                                            "c2.dita" => { aaa => 1, bbb => 1, ccc => 1, CCC => 1 },
                                          },
  results                              => [[2, "first lines"], [2, "second lines"]],
  sourceTopicToTargetBookMap           => {},
  statusLine                           => "Xref: 2 first lines, 2 second lines",
  statusTable                          => "   Count  Condition\\n1      2  first lines\\n2      2  second lines\\n",
  subjectSchemeMap                     => undef,
  suppressReferenceChecks              => undef,
  tableDimensions                      => {},
  tagCount                             => {
                                            "c1.dita" => {
                                                           "CDATA" => 4,
                                                           "conbody" => 1,
                                                           "concept" => 1,
                                                           "required-cleanup" => 3,
                                                           "title" => 1,
                                                         },
                                            "c2.dita" => {
                                                           "CDATA" => 5,
                                                           "conbody" => 1,
                                                           "concept" => 1,
                                                           "required-cleanup" => 4,
                                                           "title" => 1,
                                                         },
                                          },
  tags                                 => { "c1.dita" => 6, "c2.dita" => 7 },
  targetFolderContent                  => {},
  targetTopicToInputFiles              => {},
  texts                                => { "c1.dita" => 4, "c2.dita" => 5 },
  title                                => { "c1.dita" => "C1_", "c2.dita" => "C2_" },
  titleToFile                          => { C1_ => { "c1.dita" => 1 }, C2_ => { "c2.dita" => 1 } },
  topicFlattening                      => {},
  topicFlatteningFactor                => {},
  topicIds                             => { "c1.dita" => "c1", "c2.dita" => "c2" },
  topicsFlattened                      => undef,
  topicsNotReferencedFromBookMaps      => { "c1.dita" => 1, "c2.dita" => 1 },
  topicsReferencedFromBookMaps         => {},
  topicsToReferringBookMaps            => {},
  urls                                 => {},
  urlsBad                              => {},
  urlsGood                             => {},
  validateUrls                         => undef,
  validationErrors                     => {},
  vocabulary                           => {},
  xrefBadFormat                        => {},
  xrefBadScope                         => {},
  xRefs                                => {},
  xrefsFixedByTitle                    => [],
};

  #say STDERR writeStructureTest($x->requiredCleanUp, q($x->requiredCleanUp));
  is_deeply removeFilePathsFromStructure($x->requiredCleanUp),
   { "c1.dita" => { aaa => 1, bbb => 2 },
     "c2.dita" => { aaa => 1, bbb => 1, ccc => 1, CCC => 1 },
   };
 }

#latestTest:;
if (1) {                                                                        # Soft conrefs
lll "Test 030";
  clearFolder(tests, 111);
  createSoftConrefs(&in);

  my $x = xref(inputFolder      => in, reports => reportFolder);
  ok $x->statusLine eq q(Xref: 7 refs, 1 duplicate id, 1 duplicate topic id);

  my $y = xref
   (inputFolder      => in,
    reports          => reportFolder,
    fixRelocatedRefs => 1,
    fixedFolder      => outFixed,
   );

  ok $y->statusLine eq q(Xref: 7 refs, 1 duplicate id, 1 duplicate topic id);

  my $z = xref(inputFolder => outFixed, reports => reportFolder);
  ok $z->statusLine eq q(Xref: 6 refs, 1 duplicate id, 1 duplicate topic id);

  #dumpFile(q(/home/phil/z/xref.data), deleteVariableFields($z)); exit;
  is_deeply deleteVariableFields($z),
 {addNavTitles                         => undef,
  allowUniquePartialMatches            => undef,
  attributeCount                       => {
                                            "c.dita" => { conref => 6, id => 2 },
                                            "c_12345678123456781234567812345678.dita" => { conref => 2, id => 3 },
                                          },
  attributeNamesAndValuesCount         => {
                                            "c.dita" => {
                                              conref => {
                                                "bad" => 1,
                                                "c.dta" => 1,
                                                "c_12345678123456781234567812345678.dita" => 1,
                                                "p1" => 1,
                                                "q1" => 1,
                                              },
                                              id => { c => 1, q1 => 1 },
                                            },
                                            "c_12345678123456781234567812345678.dita" => { conref => { p1 => 1, pp => 1 }, id => { c => 1, p1 => 2 } },
                                          },
  author                               => {},
  badGuidHrefs                         => {},
  badNavTitles                         => {},
  badReferencesCount                   => 6,
  badTables                            => [],
  badXml1                              => {},
  badXml2                              => {},
  baseFiles                            => {},
  baseTag                              => {
                                            "c.dita" => "concept",
                                            "c_12345678123456781234567812345678.dita" => "concept",
                                          },
  bookMapRefs                          => {},
  changeBadXrefToPh                    => undef,
  classificationMaps                   => undef,
  conRefs                              => {
                                            "c.dita" => {
                                              "bad" => { p => 1 },
                                              "c.dta" => { p => 1 },
                                              "c_12345678123456781234567812345678.dita" => { p => 1 },
                                              "p1" => { p => 1 },
                                              "q1" => { p => 1 },
                                            },
                                            "c_12345678123456781234567812345678.dita" => { p1 => { p => 1 }, pp => { p => 1 } },
                                          },
  createReports1                       => [
                                            "reportXml1",
                                            "reportXml2",
                                            "reportDuplicateIds",
                                            "reportDuplicateTopicIds",
                                            "reportNoHrefs",
                                            "reportTables",
                                            "reportParseFailed",
                                            "reportAttributeCount",
                                            "reportLtGt",
                                            "reportTagCount",
                                            "reportTagsAndTextsCount",
                                            "reportDocTypeCount",
                                            "reportFileExtensionCount",
                                            "reportFileTypes",
                                            "reportValidationErrors",
                                            "reportGuidHrefs",
                                            "reportExternalXrefs",
                                            "reportTopicDetails",
                                            "reportTopicReuse",
                                            "reportMd5Sum",
                                            "reportOlBody",
                                            "reportHrefUrlEncoding",
                                            "reportFixRefs",
                                            "reportSourceFiles",
                                            "reportOtherMeta",
                                            "createSubjectSchemeMap",
                                            "reportTopicsNotReferencedFromBookMaps",
                                            "reportTableDimensions",
                                            "reportExteriorMaps",
                                            "createClassificationMaps",
                                            "reportIdRefs",
                                            "reportEmptyTopics",
                                            "reportConRefMatching",
                                            "reportPublicIds",
                                            "reportRequiredCleanUps",
                                          ],
  createReports2                       => ["removeUnusedIds", "reportImages"],
  currentFolder                        => "",
  deguidize                            => undef,
  deleteUnusedIds                      => 0,
  docType                              => {
                                            "c.dita" => "concept",
                                            "c_12345678123456781234567812345678.dita" => "concept",
                                          },
  duplicateIds                         => { "c_12345678123456781234567812345678.dita" => { p1 => 2 } },
  duplicateTopicIds                    => { c => ["c", "c_12345678123456781234567812345678.dita", "c.dita"] },
  emptyTopics                          => {},
  errors                               => 3,
  exteriorMaps                         => {},
  fileExtensions                       => [".dita", ".ditamap", ".xml", ".fodt"],
  fixBadRefs                           => undef,
  fixDitaRefs                          => undef,
  fixedFolder                          => undef,
  fixedFolderTemp                      => "",
  fixedRefsBad                         => [
                                            [
                                              "Not fixable",
                                              "p",
                                              "conref",
                                              "p1",
                                              "c_12345678123456781234567812345678.dita",
                                            ],
                                            [
                                              "Not fixable",
                                              "p",
                                              "conref",
                                              "pp",
                                              "c_12345678123456781234567812345678.dita",
                                            ],
                                            ["Not fixable", "p", "conref", "c.dta", "c.dita"],
                                            ["Not fixable", "p", "conref", "bad", "c.dita"],
                                            ["Not fixable", "p", "conref", "p1", "c.dita"],
                                            ["Not fixable", "p", "conref", "p1", "c.dita"],
                                          ],
  fixedRefsGB                          => [],
  fixedRefsGood                        => [],
  fixedRefsNoAction                    => [],
  fixRefs                              => {
                                            "c.dita" => { "bad" => 1, "c.dta" => 1, "p1" => 1 },
                                            "c_12345678123456781234567812345678.dita" => { p1 => 1, pp => 1 },
                                          },
  fixRelocatedRefs                     => undef,
  fixXrefsByTitle                      => undef,
  flattenFiles                         => {},
  flattenFolder                        => undef,
  getFileUrl                           => "client.pl?getFile=",
  goodImageFiles                       => {},
  goodNavTitles                        => {},
  guidHrefs                            => {},
  guidToFile                           => {},
  hrefUrlEncoding                      => {},
  html                                 => undef,
  idNotReferenced                      => {
                                            "c.dita" => { c => 1 },
                                            "c_12345678123456781234567812345678.dita" => { c => 1 },
                                          },
  idReferencedCount                    => {
                                            "c.dita" => { q1 => 1 },
                                            "c_12345678123456781234567812345678.dita" => { bad => 1, p1 => 3, pp => 1 },
                                          },
  ids                                  => {
                                            "c.dita" => { c => 1, q1 => 1 },
                                            "c_12345678123456781234567812345678.dita" => { c => 1, p1 => 2 },
                                          },
  idsRemoved                           => { c => 2 },
  idTags                               => {
                                            "c.dita" => { c => ["concept"], q1 => ["p"] },
                                            "c_12345678123456781234567812345678.dita" => { c => ["concept"], p1 => ["p", "p"] },
                                          },
  images                               => {},
  imagesReferencedFromBookMaps         => {},
  imagesReferencedFromTopics           => {},
  imagesToRefferingBookMaps            => {},
  indexedWords                         => {},
  indexWords                           => undef,
  indexWordsFolder                     => undef,
  inputFiles                           => ["c.dita", "c_12345678123456781234567812345678.dita"],
  inputFileToTargetTopics              => {},
  inputFolder                          => "",
  inputFolderImages                    => {
                                            c => "c.dita",
                                            c_12345678123456781234567812345678 => "c_12345678123456781234567812345678.dita",
                                          },
  ltgt                                 => {},
  matchTopics                          => undef,
  maxZoomIn                            => undef,
  maxZoomOut                           => { "c.dita" => {}, "c_12345678123456781234567812345678.dita" => {} },
  md5Sum                               => {
                                            "c.dita" => "c7c95918b94057943d448ca99e5424cc",
                                            "c_12345678123456781234567812345678.dita" => "d3d1c1ce281895768bd92f27fd492191",
                                          },
  md5SumDuplicates                     => {},
  missingImageFiles                    => {},
  missingTopicIds                      => {},
  noHref                               => {},
  notReferenced                        => {},
  olBody                               => {},
  originalSourceFileAndIdToNewFile     => {},
  otherMeta                            => {},
  otherMetaBookMapsAfterTopicIncludes  => [],
  otherMetaBookMapsBeforeTopicIncludes => [],
  otherMetaConsolidated                => {},
  otherMetaDuplicatesCombined          => [],
  otherMetaDuplicatesSeparately        => [],
  otherMetaPushToBookMap               => [],
  otherMetaRemainWithTopic             => [],
  oxygenProjects                       => undef,
  parseFailed                          => {},
  publicId                             => { "c.dita" => "EN", "c_12345678123456781234567812345678.dita" => "EN" },
  references                           => {
                                            "c.dita" => {
                                              "bad" => 1,
                                              "c.dta" => 1,
                                              "c_12345678123456781234567812345678.dita" => 1,
                                              "p1" => 1,
                                              "q1" => 1,
                                            },
                                            "c_12345678123456781234567812345678.dita" => { p1 => 1, pp => 1 },
                                          },
  relocatedReferencesFailed            => [],
  relocatedReferencesFixed             => [],
  reports                              => \'\',
  requestAttributeNameAndValueCounts   => undef,
  requiredCleanUp                      => {},
  results                              => [[1, "duplicate id"], [6, "refs"], [1, "duplicate topic id"]],
  sourceTopicToTargetBookMap           => {},
  statusLine                           => "Xref: 6 refs, 1 duplicate id, 1 duplicate topic id",
  statusTable                          => "   Count  Condition\\n1      6  refs\\n2      1  duplicate id\\n3      1  duplicate topic id\\n",
  subjectSchemeMap                     => undef,
  suppressReferenceChecks              => undef,
  tableDimensions                      => {},
  tagCount                             => {
                                            "c.dita" => { CDATA => 2, conbody => 1, concept => 1, p => 7, title => 1 },
                                            "c_12345678123456781234567812345678.dita" => { CDATA => 3, conbody => 1, concept => 1, p => 4, title => 1 },
                                          },
  tags                                 => { "c.dita" => 10, "c_12345678123456781234567812345678.dita" => 7 },
  targetFolderContent                  => {},
  targetTopicToInputFiles              => {},
  texts                                => { "c.dita" => 2, "c_12345678123456781234567812345678.dita" => 3 },
  title                                => { "c.dita" => "C2", "c_12345678123456781234567812345678.dita" => "C1" },
  titleToFile                          => {
                                            C1 => { "c_12345678123456781234567812345678.dita" => 1 },
                                            C2 => { "c.dita" => 1 },
                                          },
  topicFlattening                      => {},
  topicFlatteningFactor                => {},
  topicIds                             => { "c.dita" => "c", "c_12345678123456781234567812345678.dita" => "c" },
  topicsFlattened                      => undef,
  topicsNotReferencedFromBookMaps      => { "c.dita" => 1, "c_12345678123456781234567812345678.dita" => 1 },
  topicsReferencedFromBookMaps         => {},
  topicsToReferringBookMaps            => {},
  urls                                 => {},
  urlsBad                              => {},
  urlsGood                             => {},
  validateUrls                         => undef,
  validationErrors                     => {},
  vocabulary                           => {},
  xrefBadFormat                        => {},
  xrefBadScope                         => {},
  xRefs                                => {},
  xrefsFixedByTitle                    => [],
};
 }

#latestTest:;
if (1) {                                                                        # Oxygen project files
lll "Test 031";
  clearFolder(tests, 111);
  createSampleInputFilesBaseCase(&in, 8);

  my $x = xref(inputFolder => in, reports => reportFolder, oxygenProjects=>1);
  ok $x->statusLine eq q(Xref: 104 refs, 21 image refs, 14 first lines, 14 second lines, 8 duplicate ids, 4 duplicate topic ids, 4 invalid guid hrefs, 2 duplicate files, 2 tables, 1 External xrefs with no format=html, 1 External xrefs with no scope=external, 1 file failed to parse, 1 href missing);
 }

#latestTest:;
if (0) {                                                                        # Performance tests 1.419
lll "Test 032";
  my $folder = q(/home/phil/perl/cpan/DataEditXmlXref/lib/Data/Edit/Xml/samples/);
  xref(inputFolder => $folder);
 }

#latestTest:;
if (1) {                                                                        # Urls
lll "Test 033 Urls";
  clearFolder(tests, 222);
  createUrlTests(&in);

  my $x = xref(inputFolder => in, reports => reportFolder, validateUrls=>1);

  ok $x->statusLine eq q(Xref: 2 urls);

#  dumpFile(q(/home/phil/z/xref.data), deleteVariableFields($x));
  is_deeply deleteVariableFields($x),
bless({
  addNavTitles                         => undef,
  allowUniquePartialMatches            => undef,
  attributeCount                       => {
                                            "concept.dita" => { format => 2, href => 2, id => 1, scope => 2 },
                                          },
  attributeNamesAndValuesCount         => {
                                            "concept.dita" => {
                                              format => { html => 2 },
                                              href => { "ww2.appaapps.com" => 1, "www.appaapps.com" => 1 },
                                              id => { c => 1 },
                                              scope => { external => 2 },
                                            },
                                          },
  author                               => {},
  badGuidHrefs                         => {},
  badNavTitles                         => {},
  badReferencesCount                   => 0,
  badTables                            => [],
  badXml1                              => {},
  badXml2                              => {},
  baseFiles                            => {},
  baseTag                              => { "concept.dita" => "concept" },
  bookMapRefs                          => {},
  changeBadXrefToPh                    => undef,
  classificationMaps                   => undef,
  conRefs                              => {},
  createReports1                       => [
                                            "reportXml1",
                                            "reportXml2",
                                            "reportDuplicateIds",
                                            "reportDuplicateTopicIds",
                                            "reportNoHrefs",
                                            "reportTables",
                                            "reportParseFailed",
                                            "reportAttributeCount",
                                            "reportLtGt",
                                            "reportTagCount",
                                            "reportTagsAndTextsCount",
                                            "reportDocTypeCount",
                                            "reportFileExtensionCount",
                                            "reportFileTypes",
                                            "reportValidationErrors",
                                            "reportGuidHrefs",
                                            "reportExternalXrefs",
                                            "reportTopicDetails",
                                            "reportTopicReuse",
                                            "reportMd5Sum",
                                            "reportOlBody",
                                            "reportHrefUrlEncoding",
                                            "reportFixRefs",
                                            "reportSourceFiles",
                                            "reportOtherMeta",
                                            "createSubjectSchemeMap",
                                            "reportTopicsNotReferencedFromBookMaps",
                                            "reportTableDimensions",
                                            "reportExteriorMaps",
                                            "createClassificationMaps",
                                            "reportIdRefs",
                                            "reportEmptyTopics",
                                            "reportConRefMatching",
                                            "reportPublicIds",
                                            "reportRequiredCleanUps",
                                            "reportUrls",
                                          ],
  createReports2                       => ["removeUnusedIds", "reportImages"],
  currentFolder                        => "",
  deguidize                            => undef,
  deleteUnusedIds                      => 0,
  docType                              => { "concept.dita" => "concept" },
  duplicateIds                         => {},
  duplicateTopicIds                    => {},
  emptyTopics                          => {},
  errors                               => 1,
  exteriorMaps                         => {},
  fileExtensions                       => [".dita", ".ditamap", ".xml", ".fodt"],
  fixBadRefs                           => undef,
  fixDitaRefs                          => undef,
  fixedFolder                          => undef,
  fixedFolderTemp                      => "",
  fixedRefsBad                         => [],
  fixedRefsGB                          => [],
  fixedRefsGood                        => [],
  fixedRefsNoAction                    => [],
  fixRefs                              => {},
  fixRelocatedRefs                     => undef,
  fixXrefsByTitle                      => undef,
  flattenFiles                         => {},
  flattenFolder                        => undef,
  getFileUrl                           => "client.pl?getFile=",
  goodImageFiles                       => {},
  goodNavTitles                        => {},
  guidHrefs                            => {},
  guidToFile                           => {},
  hrefUrlEncoding                      => {},
  html                                 => undef,
  idNotReferenced                      => { "concept.dita" => { c => 1 } },
  idReferencedCount                    => {},
  ids                                  => { "concept.dita" => { c => 1 } },
  idsRemoved                           => { c => 1 },
  idTags                               => { "concept.dita" => { c => ["concept"] } },
  images                               => {},
  imagesReferencedFromBookMaps         => {},
  imagesReferencedFromTopics           => {},
  imagesToRefferingBookMaps            => {},
  indexedWords                         => {},
  indexWords                           => undef,
  indexWordsFolder                     => undef,
  inputFiles                           => ["concept.dita"],
  inputFileToTargetTopics              => {},
  inputFolder                          => "",
  inputFolderImages                    => { concept => "concept.dita" },
  ltgt                                 => {},
  matchTopics                          => undef,
  maxZoomIn                            => undef,
  maxZoomOut                           => { "concept.dita" => {} },
  md5Sum                               => { "concept.dita" => "f38f3212622c0fd073b213176a045e47" },
  md5SumDuplicates                     => {},
  missingImageFiles                    => {},
  missingTopicIds                      => {},
  noHref                               => {},
  notReferenced                        => {},
  olBody                               => {},
  originalSourceFileAndIdToNewFile     => {},
  otherMeta                            => {},
  otherMetaBookMapsAfterTopicIncludes  => [],
  otherMetaBookMapsBeforeTopicIncludes => [],
  otherMetaConsolidated                => {},
  otherMetaDuplicatesCombined          => [],
  otherMetaDuplicatesSeparately        => [],
  otherMetaPushToBookMap               => [],
  otherMetaRemainWithTopic             => [],
  oxygenProjects                       => undef,
  parseFailed                          => {},
  publicId                             => { "concept.dita" => "EN" },
  references                           => {},
  relocatedReferencesFailed            => [],
  relocatedReferencesFixed             => [],
  reports                              => "",
  requestAttributeNameAndValueCounts   => undef,
  requiredCleanUp                      => {},
  results                              => [[2, "urls"]],
  sourceTopicToTargetBookMap           => {},
  statusLine                           => "Xref: 2 urls",
  statusTable                          => "   Count  Condition\\n1      2  urls\\n",
  subjectSchemeMap                     => undef,
  suppressReferenceChecks              => undef,
  tableDimensions                      => {},
  tagCount                             => {
                                            "concept.dita" => { CDATA => 3, conbody => 1, concept => 1, p => 2, title => 1, xref => 2 },
                                          },
  tags                                 => { "concept.dita" => 7 },
  targetFolderContent                  => {},
  targetTopicToInputFiles              => {},
  texts                                => { "concept.dita" => 3 },
  title                                => { "concept.dita" => "Urls" },
  titleToFile                          => { Urls => { "concept.dita" => 1 } },
  topicFlattening                      => {},
  topicFlatteningFactor                => {},
  topicIds                             => { "concept.dita" => "c" },
  topicsFlattened                      => undef,
  topicsNotReferencedFromBookMaps      => { "concept.dita" => 1 },
  topicsReferencedFromBookMaps         => {},
  topicsToReferringBookMaps            => {},
  urls                                 => {
                                            "concept.dita" => { "ww2.appaapps.com" => 1, "www.appaapps.com" => 1 },
                                          },
  urlsBad                              => {
                                            "ww2.appaapps.com" => { "concept.dita" => 1 },
                                            "www.appaapps.com" => { "concept.dita" => 1 },
                                          },
  urlsGood                             => {},
  validateUrls                         => 1,
  validationErrors                     => {},
  vocabulary                           => {},
  xrefBadFormat                        => {},
  xrefBadScope                         => {},
  xRefs                                => {},
  xrefsFixedByTitle                    => [],
}, "Data::Edit::Xml::Xref")
 }

clearFolder($_, 1e3) for in, out, outFixed, reportFolder, tests, targets, q(zzzParseErrors);

done_testing;

lll "Tests finished:";  # 16.212
' called at lib/Data/Edit/Xml/Xref.pm line 6043
	Data::Edit::Xml::Xref::test() called at test.pl line 10
 at /tmp/loop_over_bdir-31753-iDm7aS/Data-Table-Text-20200418-0/blib/lib/Data/Table/Text.pm line 4095.
	Data::Table::Text::__ANON__("Failed to write to file:\x{a}/tmp/iGnrehoRXQ/report/timing/xref_p"...) called at /home/sand/src/perl/repoperls/installed-perls/host/k93buster/v5.31.10/9de7/lib/5.31.10/Carp.pm line 292
	Carp::confess("Failed to write to file:\x{a}/tmp/iGnrehoRXQ/report/timing/xref_p"...) called at /tmp/loop_over_bdir-31753-iDm7aS/Data-Table-Text-20200418-0/blib/lib/Data/Table/Text.pm line 978
	Data::Table::Text::overWriteFile("/tmp/iGnrehoRXQ/report/timing/xref_phases.txt", "Processing phases elapsed times in descending order\x{a}\x{a}Xref pha"...) called at /tmp/loop_over_bdir-31753-iDm7aS/Data-Table-Text-20200418-0/blib/lib/Data/Table/Text.pm line 2690
	Data::Table::Text::formatTable(ARRAY(0x55b37f9a6330), "columns", "Phase         Xref processing phase\x{a}Time_Seconds  Time in sec"..., "head", "Xref phases took the following times on DDDD\x{a}\x{a}Total run time:"..., "title", "Processing phases elapsed times in descending order", "file", ...) called at /tmp/loop_over_bdir-31753-iDm7aS/Data-Table-Text-20200418-0/blib/lib/Data/Table/Text.pm line 2957
	Data::Table::Text::formatHtmlAndTextTables("/tmp/iGnrehoRXQ/report/", undef, "/cgi-bin/uiSelfServiceXref/client.pl?getFile=", "/tmp/iGnrehoRXQ/outFixed/", ARRAY(0x55b37f9a6330), "head", "Xref phases took the following times on DDDD\x{a}\x{a}Total run time:"..., "file", ...) called at lib/Data/Edit/Xml/Xref.pm line 559
	Data::Edit::Xml::Xref::formatTables(Data::Edit::Xml::Xref=HASH(0x55b37f9ad400), ARRAY(0x55b37f9a6330), "columns", "Phase         Xref processing phase\x{a}Time_Seconds  Time in sec"..., "title", "Processing phases elapsed times in descending order", "head", "Xref phases took the following times on DDDD\x{a}\x{a}Total run time:"..., ...) called at lib/Data/Edit/Xml/Xref.pm line 334
	Data::Edit::Xml::Xref::xref2("inputFolder", "/tmp/iGnrehoRXQ/outFixed/", "reports", "/tmp/iGnrehoRXQ/report/") called at lib/Data/Edit/Xml/Xref.pm line 432
	Data::Edit::Xml::Xref::__ANON__ called at /tmp/loop_over_bdir-31753-iDm7aS/Data-Table-Text-20200418-0/blib/lib/Data/Table/Text.pm line 5424
	Data::Table::Text::callSubInParallel(CODE(0x55b37f9e35b8)) called at lib/Data/Edit/Xml/Xref.pm line 432
	Data::Edit::Xml::Xref::xref("inputFolder", "/tmp/iGnrehoRXQ/outFixed/", "reports", "/tmp/iGnrehoRXQ/report/") called at (eval 113) line 1419
	eval 'use Test::More;
use warnings FATAL=>qw(all);

use strict;

if ($^O !~ m(bsd|linux)i)
 {plan skip_all => \'Not supported\';
 }

Test::More->builder->output("/dev/null")                                        # Show only errors during testing
  if ((caller(1))[0]//\'Data::Edit::Xml::Xref\') eq "Data::Edit::Xml::Xref";

makeDieConfess;

my $conceptHeader = <<END =~ s(\\s*\\Z) ()gsr;                                    # Header for a concept
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Task//EN" "concept.dtd" []>
END

mmm "Tests started";

my $testsFolder = temporaryFolder;                                              # Tests folder

#goto latestTest;

sub tests       {$testsFolder}
sub in          {fpd tests, q(in)}                                              # Input folder
sub out         {fpd tests, q(out)}                                             # Output folder
sub outFixed    {fpd tests, q(outFixed)}                                        # Fixed output folder
sub reportFolder{fpd tests, q(report)}                                          # Reports folder
sub targets     {fpf tests, q(targets)}                                         # Tests targets folder

#D1 Create test data                                                            # Create files to test the various capabilities provided by Xref

sub createSampleInputFilesBaseCase($$)                                          #P Create sample input files for testing. The attribute B<inputFolder> supplies the name of the folder in which to create the sample files.
 {my ($in, $N) = @_;                                                            # Input folder, number of sample files
  clearFolder($in, 1e2);
  for my $n(1..$N)
   {my $o = $n + 1; $o -= $N if $o > $N;
    my $f = owf(fpe($in, $n, q(dita)), <<END);
<concept id="c$n" xtrf="$n.dita">
  <title>Concept $n refers to $o</title>
  <conbody id="b$n">
     <xref id="x$n"  format="dita" href="$o.dita#c$o/x$o">Good</xref>
     <xref id="x$n"  format="dita" href="$o.dita#c$n/x$o">Duplicate id</xref>
     <xref id="b1$n" format="dita" href="bad$o.dita#c$o/x$o">Bad file</xref>
     <xref id="b2$n" format="dita" href="$o.dita#c$n/x$o">Bad topic id</xref>
     <xref id="b3$n" format="dita" href="$o.dita#c$o/x$n">Bad id in topic</xref>
     <xref id="g1$n" format="dita" href="$o.dita#c$o">Good 1</xref>
     <xref id="g2$n" format="dita" href="#c$o/x$o">Good 2</xref>
     <xref id="g3$n" format="dita" href="#c$o">Good 3</xref>
     <p conref="#c$n">Good conref</p>
     <p conref="#b$n">Bad conref</p>
     <image href="a$n.png"/>
     <image href="b$n.png"/>
     <ol><li/><li/></ol>
  </conbody>
</concept>
END
   }

  owf(fpe($in, qw(act1 dita)), <<END);
<concept id="guid-000">
  <title id="title">All Timing Codes Begin Here</title>
  <author>Phil</author>
  <conbody>
    <p>Note: see below</p>
    <p>Important: ignore all notes above</p>
    <image href="guid-000"/>
    <image href="guid-act1"/>
    <image href="guid-9999"/>
    <image href="act1.png"/>
    <xref/>
     <ol><li/><li/></ol>
     <ol><li/><li/></ol>
  </conbody>
</concept>
END

  owf(fpe($in, qw(act2 dita)), <<END);
$conceptHeader
<concept id="c2">
  <title id="title">Jumping Through Hops</title>
  <conbody>
    <section>
      <title/>
      <xref  format="dita" href="act1.dita#c1/title">All Timing Codes Begin Here</xref>
      <note  conref="act2.dita#c2/title"/>
      <xref  format="dita" href="9999#c1/title"/>
      <xref  format="dita" href="guid-000#guid-000/title"/>
      <xref  format="dita" href="guid-001#guid-001/title guid-000#guid-000/title"/>
      <xref  format="dita" href="guid-000#guid-000/title2"/>
      <xref  format="dita" href="guid-000#c1/title2"/>
      <xref  format="dita" href="guid-999#c1/title2"/>
      <xref  href="http://"/>
      <image href="act2.png"/>
      <link href="guid-000"/>
      <link href="guid-999"/>
      <link href="act1.dita"/>
      <link href="act9999.dita"/>
      <p conref="9999.dita"/>
      <p conref="bookmap.ditamap"/>
      <p conref="bookmap2.ditamap"/>
    </section>
    <required-cleanup>PLEX18</required-cleanup>
  </conbody>
</concept>
<!--linted: 2018-Nov-23 -->
END

  owf(fpe($in, qw(act3 dita)), <<END);
<concept id="c3">
  <title>Jumping Through Hops</title>
  <conbody>
    <p/>
  </body>
</concept>
END

  owf(fpe($in, qw(act4 dita)), <<END);
<concept id="c4">
  <taskbody/>
</concept>
END

  owf(fpe($in, qw(act5 dita)), <<END);
<concept id="c5">
  <taskbody/>
</concept>
END

  owf(fpe($in, qw(table dita)), <<END);
$conceptHeader
<concept id="table">
  <title>Tables</title>
  <conbody>
    <image href="new pass.png"/>
    <table>
      <tgroup cols="1">
        <thead>
          <row>
            <entry>
              <p>Significant Event</p>
            </entry>
            <entry>
              <p>Audit Event</p>
            </entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry/>
          </row>
        </tbody>
      </tgroup>
    </table>
    <table>
      <tgroup cols="1">
        <colspec/>
        <colspec/>
        <thead>
          <row>
            <entry>aaaa</entry>
            <entry>bbbb</entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry>aaaa</entry>
            <entry>bbbb</entry>
          </row>
          <row>
            <entry>aaaa</entry>
            <entry>bbbb</entry>
          </row>
        </tbody>
      </tgroup>
    </table>
  </conbody>
</concept>
END

  owf(fpe($in, qw(map bookmap ditamap)), <<END);
<map id="m1">
  <title>Test</title>
  <chapter  href="yyyy.dita">
    <topicref href="../act1.dita">Interesting topic</topicref>
    <topicref href="../act2.dita"/>
    <topicref href="../map/r.txt"/>
    <topicref href="9999.dita"/>
    <topicref href="bbb.txt"/>
    <topicref href="guid-000"/>
    <topicref href="guid-888"/>
    <topicref href="guid-999"/>
  </chapter>
</map>
END
  owf(fpe($in, qw(map bookmap2 ditamap)), <<END);
<map id="m2">
  <title>Test 2</title>
  <chapter  href="zzzz.dita">
    <topicref href="../act1.dita">Interesting topic</topicref>
    <topicref href="../act2.dita"/>
    <topicref href="../map/r.txt"/>
    <topicref href="9999.dita"/>
    <topicref href="bbb.txt"/>
    <topicref href="guid-000"/>
    <topicref href="guid-888"/>
    <topicref href="guid-999"/>
  </chapter>
</map>
END
  owf(fpe($in, qw(map bookmap3 ditamap)), <<END);
<map id="m2">
  <title>Test 3</title>
  <chapter  href="../act3.dita"/>
  <chapter  href="../act4.dita"/>
  <chapter  href="../act5.dita"/>
</map>
END
  createEmptyFile(fpe($in, qw(a1 png)));
 }

sub createSampleInputFilesFixFolder($)                                          #P Create sample input files for testing fixFolder
 {my ($in) = @_;                                                                # Folder to create the files in
  owf(fpe($in, 1, q(dita)), <<END);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE reference PUBLIC "-//PHIL//DTD DITA Task//EN" "concept.dtd" []>
<concept id="c1">
  <title>Concept 1 which refers to concept 2</title>
  <conbody>
     <p conref="2.dita#c2/p1"/>
     <p conref="2.dita#c2/p2"/>
     <p conref="3.dita#c2/p1"/>
     <xref href="2.dita#c2/p1"/>
     <xref href="2.dita#c2/p2"/>
     <xref href="3.dita#c2/p1"/>
  </conbody>
</concept>
END

  owf(fpe($in, 2, q(dita)), <<END);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE reference PUBLIC "-//PHIL//DTD DITA Task//EN" "concept.dtd" []>
<concept id="c2">
  <title>Concept 2 which does not refer to anything</title>
  <conbody>
     <p id="p1">Para 1 &lt;hello&gt; aaa &lt;goodbye&gt;</p>
     <p id="p2">Para 2 &lt;hello&gt; bbb &lt;goodbye&gt;</p>
  </conbody>
</concept>
END
 }

sub createSampleInputFilesLtGt($)                                               #P Create sample input files for testing items between &lt; and &gt;
 {my ($in) = @_;                                                                # Folder to create the files in
  owf(fpe($in, 1, q(dita)), <<END);
$conceptHeader
<concept id="c1">
  <title>Concept 1 which refers to concept 2</title>
  <conbody>
     <p>&lt;aaa&gt; AAAA &lt;bbb&gt;</p>
  </conbody>
</concept>
END
 }

sub createSampleInputFilesForFixDitaRefs($$)                                    #P Create sample input files for fixing renamed topic refs
 {my ($in, $targets) = @_;                                                      # Folder to create the files in, targets folder
  my $d = absFromAbsPlusRel(currentDirectory, $in);
  my @targets;

  push @targets, [owf(fpe($in, 1, q(ditamap)), <<END), q(1.ditamap)];
<map xtrf="${d}1.ditamap">
  <title>aaaa map</title>
  <topicref href="a.dita"/>
</map>
END

  push @targets, [owf(fpe($in, qw(a1 dita)), <<END), q(a.dita)];
<concept id="ca1" xtrf="${d}a.dita">
  <title>aaaa topic 111</title>
  <conbody>
    <p id="a1" conref="b.dita#b/b1"/>
  </conbody>
</concept>
END

  push @targets, [owf(fpe($in, qw(a2 dita)), <<END), q(a2.dita)];
<concept id="ca2" xtrf="${d}a.dita">
  <title>aaaa topic 222</title>
  <conbody>
    <p id="a2" conref="#./a1"/>
  </conbody>
</concept>
END

  push @targets, [owf(fpe($in, qw(b1 dita)), <<END), q(b1.dita)];
<concept id="cb1" xtrf="${d}b.dita">
  <title>bbbb topic 111</title>
  <conbody>
    <p id="b1" conref="a.dita#a/a1"/>
  </conbody>
</concept>
END

  push @targets, [owf(fpe($in, qw(b2 dita)), <<END), q(b2.dita)];
<concept id="cb2" xtrf="${d}b.dita">
  <title>bbbb topic 222</title>
  <conbody>
    <p id="b2" conref="#./b2"/>
  </conbody>
</concept>
END

  for my $target(@targets)                                                      # Create targets folder
   {owf(fpf($targets, $$target[1]), $$target[0]);
   }
 }

sub createSampleInputFilesForFixDitaRefsXref($)                                 #P Create sample input files for fixing references into renamed topics by xref
 {my ($in) = @_;                                                                # Folder to create the files in
  my $d = fpd(currentDirectory, $in);
  owf(fpe($in, qw(a1 dita)), <<END);
<concept id="ca1" xtrf="${d}a.dita">
  <title>aaaa topic 111</title>
  <conbody>
    <xref href="b.dita#b/b1"/>
  </conbody>
</concept>
END
  owf(fpe($in, qw(b1 dita)), <<END);
<concept id="cb1" xtrf="${d}b.dita">
  <title>bbbb topic 111</title>
  <conbody>
    <p id="b1"/>
  </conbody>
</concept>
END
  owf(fpe($in, qw(b2 dita)), <<END);
<concept id="cb2" xtrf="${d}b.dita">
  <title>bbbb topic 222</title>
  <conbody>
    <p id="b2"/>
  </conbody>
</concept>
END
 }

sub createSampleConRefs($)                                                      #P Create sample input files for fixing a conref
 {my ($in) = @_;                                                                # Folder to create the files in
  my $d = fpd(currentDirectory, $in);
  owf(fpe($in, qw(c1 dita)), <<END);
<concept id="c1">
  <title>1111</title>
  <conbody>
    <p id="i1" conref="c2.dita#c2/p1"/>
    <p id="i2" conref="c2.dita#c2/p2"/>
    <p id="i2" conref="c2.dita#c2/p3"/>
    <xref id="c1" href="c1.dita#c1/i1"/>
    <xref id="x1" href="c1.dita#c1/i2"/>
    <xref href="c1.dita#c1/i3"/>
    <xref href="c1.dita#c1/i3"/>
    <xref href="c1.dita#c1/i3"/>
  </conbody>
</concept>
END
  owf(fpe($in, qw(c2 dita)), <<END);
<concept id="c2">
  <title id="c2">2222</title>
  <conbody>
    <p id="p1">p1p1p1p1</p>
    <p id="p2">p2p2p2p2</p>
  </conbody>
</concept>
END
 }

sub createSampleConRefMatching($)                                               #P Create sample input files for matching conref source and targets
 {my ($in) = @_;                                                                # Folder to create the files in
  my $d = fpd(currentDirectory, $in);
  owf(fpe($in, qw(c1 dita)), <<END);
<concept id="c1">
  <title>1111</title>
  <conbody>
    <p conref="c2.dita#c2/p1"/>
    <p conref="c2.dita#c2/q1"/>
  </conbody>
</concept>
END
  owf(fpe($in, qw(c2 dita)), <<END);
<concept id="c2">
  <title>2222</title>
  <conbody>
    <p id="p1">p1p1p1p1</p>
    <q id="q1">q1q1q1q1</q>
  </conbody>
</concept>
END
 }

sub createSampleDuplicateMd5Sum($)                                              #P Create sample input files with duplicate md5 sums
 {my ($in) = @_;                                                                # Folder to create the files in
  my $d = fpd(currentDirectory, $in);
  owf(fpe($in, $_, qw(c dita)), <<END) for 1..3;
<concept/>
END
  owf(fpe($in, $_, qw(t dita)), <<END) for 1..2;
<task/>
END
 }

sub createSampleUnreferencedIds($)                                              #P Create sample input files with unreferenced ids
 {my ($in) = @_;                                                                # Folder to create the files in
  my $d = fpd(currentDirectory, $in);
  owf(fpe($in, $_, qw(c1 dita)), <<END);
<concept id="c1">
  <title id="c1"/>
  <conbody>
    <p id="p1"/>
    <p id="p2"/>
    <p id="p2"/>
    <p id="p3"/>
    <p id="p3"/>
    <p id="p3"/>
  </conbody>
</concept>
END
  owf(fpe($in, $_, qw(c2 dita)), <<END);
<concept id="c2">
  <title id="c2"/>
  <conbody>
    <p href="c1.dita#p1"/>
    <p conref="c1.dita#c1/p2"/>
  </conbody>
</concept>
END
 }

sub createEmptyBody($)                                                          #P Create sample input files for empty body detection
 {my ($in) = @_;                                                                # Folder to create the files in
  my $d = fpd(currentDirectory, $in);
  owf(fpe($in, qw(c1 dita)), <<END);
$conceptHeader
<concept id="c1">
  <title>Empty</title>
  <conbody/>
</concept>
END
  owf(fpe($in, qw(c2 dita)), <<END);
$conceptHeader
<concept id="c2">
  <title>Full</title>
  <conbody>
    <p>2222</p>
  </conbody>
</concept>
END
 }

sub createClassificationMapsTest($)                                             #P Create sample input files for a classification map
 {my ($in) = @_;                                                                # Folder to create the files in
  my $d = fpd($in);
  owf(fpe($in, qw(maps m1 ditamap)), <<END);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map id="m1">
    <title>A map that is not nested</title>
    <mapref   href="m2.ditamap"/>
    <topicref href="../c1.dita"/>
    <topicref href="../c2.dita"/>
</map>
END
  owf(fpe($in, qw(maps m2 ditamap)), <<END);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map id="m2">
    <title>A map that is nested</title>
    <topicref href="../c1.dita"/>
    <topicref href="../c2.dita"/>
</map>
END
  owf(fpe($in, qw(c1 dita)), <<END);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="c1">
    <title>Concept 1</title>
    <prolog>
        <metadata>
            <othermeta content="concept" name="topic_type ee ee aa"/>
            <othermeta content="Developer_Guide_Reference Salesforce_Console" name="app_area"/>
        </metadata>
    </prolog>
    <conbody/>
</concept>
END
  owf(fpe($in, qw(c2 dita)), <<END);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="c2">
    <title>Concept 2</title>
    <prolog>
        <metadata>
            <othermeta content="Developer Partner" name="role"/>
            <othermeta content="PE EE PXE UE DE" name="edition"/>
            <othermeta content="aloha sfx aloha" name="ui_platform"/>
        </metadata>
    </prolog>
    <conbody/>
</concept>
END
 }

sub createWordsToFilesTest($)                                                   #P Index words to file
 {my ($in) = @_;                                                                # Folder to create the files in
  owf(fpe($in, qw(spaghetti dita)), <<END);
<task id="t1">
  <title>How to cook spaghetti</title>
  <taskbody>

    <context><p>You are in a well equipped kitchen with a packet of spaghetti
    to hand.  You wish to cook some spaghetti</p></context>

    <steps>
      <step>
        <cmd>Bring a large pan of water to a rolling boil</cmd>
      </step>
      <step>
        <cmd>Place the spaghetti in the boiling water</cmd>
      </step>
      <step>
        <cmd>Cover the pan with a lid and turn the heat down</cmd>
      </step>
      <step>
        <cmd>Cook for 15 minutes then drain through a collander</cmd>
      </step>
      </steps>
  </taskbody>
</task>
END
  owf(fpe($in, qw(tea dita)), <<END);
<task id="t2">
  <title>How to make a cup of tea</title>
  <taskbody>

    <context><p>You are in a well equipped kitchen with a packet of tea bags to hand.
    You wish to make a cup of tea</p></context>

    <steps>
      <step>
        <cmd>Bring a kettle of water to the boil</cmd>
      </step>
      <step>
        <cmd>Place a tea bag in an insulated glass</cmd>
      </step>
      <step>
        <cmd>Pour hot water over the tea bag until the glass is 80% full</cmd>
      </step>
      <step>
        <cmd>Place the glass in a microwave oven and power for 30 seconds.</cmd>
      </step>
      </steps>
  </taskbody>
</task>
END
 }

sub createUrlTests($)                                                           #P Check urls
 {my ($in) = @_;                                                                # Folder to create the files in
  owf(fpe($in, qw(concept dita)), <<END);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="c">
  <title>Urls</title>
  <conbody>
    <p><xref format="html" href="https://www.appaapps.com" scope="external">aaa</xref></p>
    <p><xref format="html" href="https://ww2.appaapps.com" scope="external">bbb</xref></p>
  </conbody>
</concept>
END
 }

sub changeFolderAndWriteFiles($$)                                               #P Change file structure to the current folder and write
 {my ($f, $D) = @_;                                                             # Data structure as a string, target folder
  my $d = q(/home/phil/perl/cpan/DataEditXmlToDita/test/);
  my $F = eval(dump($f) =~ s($d) ($D)gsr);
  writeFiles($F);                                                               # Change folder and write test files
 }

sub createSampleInputFilesForFixDitaRefsImproved1($)                            #P Create sample input files for fixing references via the targets/ folder
 {my ($folder) = @_;                                                            # Folder to switch to
  my $f = {
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_4ef751d67c53ac33272c3bbe16284b0d.ditamap"  => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []>\\n<bookmap id=\\"GUID-18c89db5-781b-666a-f24a-fbafa6d70733\\">\\n  <chapter href=\\"a.dita\\" navtitle=\\"aaaa\\">\\n    <topicref href=\\"b.dita\\" navtitle=\\"aaaa\\"/>\\n  </chapter>\\n</bookmap>\\n<!--linted: 2019-06-22 at 21:16:47 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: bookmap -->\\n<!--docType: <!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_4ef751d67c53ac33272c3bbe16284b0d.ditamap -->\\n<!--guid: GUID-18c89db5-781b-666a-f24a-fbafa6d70733 -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/ab.ditamap -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 885 -->\\n<!--project: all -->\\n<!--title: ab -->\\n<!--definition: GUID-18c89db5-781b-666a-f24a-fbafa6d70733 -->\\n<!--labels: GUID-18c89db5-781b-666a-f24a-fbafa6d70733 b1 -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_ca202b3f0a58c67675f9704a32546cea.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-1581d732-b13a-edf0-2651-220a78f1c0fa\\">\\n  <title>aaaa</title>\\n  <conbody>\\n    <p>Aaa aaa aaa</p>\\n  </conbody>\\n</concept>\\n<!--linted: 2019-06-22 at 21:16:47 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_ca202b3f0a58c67675f9704a32546cea.dita -->\\n<!--guid: GUID-1581d732-b13a-edf0-2651-220a78f1c0fa -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/b.dita -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 885 -->\\n<!--project: all -->\\n<!--title: aaaa -->\\n<!--definition: GUID-1581d732-b13a-edf0-2651-220a78f1c0fa -->\\n<!--labels: GUID-1581d732-b13a-edf0-2651-220a78f1c0fa cb -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/a.dita"                                   => "{\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_ca202b3f0a58c67675f9704a32546cea.dita\\",\\n  targetType => \\"topic\\",\\n}",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/ab.ditamap"                               => "{\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/ab.ditamap\\",\\n  sourceDocType => \\"bookmap\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_4ef751d67c53ac33272c3bbe16284b0d.ditamap\\",\\n  targetType => \\"bookmap\\",\\n}",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/b.dita"                                   => "{\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/b.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_ca202b3f0a58c67675f9704a32546cea.dita\\",\\n  targetType => \\"topic\\",\\n}",
  };

  changeFolderAndWriteFiles($f, $folder);                                       # Change folder and write files
 }

sub createSampleInputFilesForFixDitaRefsImproved2($)                            #P Create sample input files for fixing conref references via the targets/ folder
 {my ($folder) = @_;                                                            # Folder to switch to
  my $f = {
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_c8e30fbb422819ab92e1752ca50bb158.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-48fb251a-9a88-3bcc-d81b-301f426ed439\\">\\n  <title>aaaa</title>\\n  <conbody>\\n    <p conref=\\"b.dita#cb/p1\\">aaaa</p>\\n  </conbody>\\n</concept>\\n<!--linted: 2019-06-22 at 21:16:47 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_c8e30fbb422819ab92e1752ca50bb158.dita -->\\n<!--guid: GUID-48fb251a-9a88-3bcc-d81b-301f426ed439 -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 885 -->\\n<!--project: all -->\\n<!--title: aaaa -->\\n<!--definition: GUID-48fb251a-9a88-3bcc-d81b-301f426ed439 -->\\n<!--labels: GUID-48fb251a-9a88-3bcc-d81b-301f426ed439 ca -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_e374c26206dc955160cecea10306509d.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-e9997c20-3dcf-6958-f762-09d8250bc53e\\">\\n  <title>bbbb</title>\\n  <conbody>\\n    <p id=\\"p1\\">bbbb</p>\\n  </conbody>\\n</concept>\\n<!--linted: 2019-06-22 at 21:16:47 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_e374c26206dc955160cecea10306509d.dita -->\\n<!--guid: GUID-e9997c20-3dcf-6958-f762-09d8250bc53e -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/b.dita -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 885 -->\\n<!--project: all -->\\n<!--title: bbbb -->\\n<!--definition: p1 -->\\n<!--definition: GUID-e9997c20-3dcf-6958-f762-09d8250bc53e -->\\n<!--labels: GUID-e9997c20-3dcf-6958-f762-09d8250bc53e cb -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/a.dita"                                   => "{\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_c8e30fbb422819ab92e1752ca50bb158.dita\\",\\n  targetType => \\"topic\\",\\n}",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/b.dita"                                   => "{\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/b.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_e374c26206dc955160cecea10306509d.dita\\",\\n  targetType => \\"topic\\",\\n}",
  };

  changeFolderAndWriteFiles($f, $folder);                                       # Change folder and write files
 }

sub createSampleInputFilesForFixDitaRefsImproved3($)                            #P Create sample input files for fixing bookmap references to topics that get cut into multiple pieces
 {my ($folder) = @_;                                                            # Folder to switch to
  my $f = {
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_6661b95b6e3802e892116df5a3307e8f.ditamap"   => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []>\\n<bookmap id=\\"GUID-2a901384-59f3-9fdb-de14-546a63d03dfa\\">\\n  <chapter href=\\"a.dita\\" navtitle=\\"aaaa\\"/>\\n</bookmap>\\n<!--linted: 2019-06-25 at 21:04:31 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: bookmap -->\\n<!--docType: <!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_6661b95b6e3802e892116df5a3307e8f.ditamap -->\\n<!--guid: GUID-2a901384-59f3-9fdb-de14-546a63d03dfa -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.ditamap -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 929 -->\\n<!--project: all -->\\n<!--title: a -->\\n<!--definition: GUID-2a901384-59f3-9fdb-de14-546a63d03dfa -->\\n<!--labels: GUID-2a901384-59f3-9fdb-de14-546a63d03dfa bm -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_a_6b2bcb0e0a5337f3bb3b28099e892b3d.ditamap" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []>\\n<bookmap id=\\"GUID-8e2504aa-ea92-9307-7bd1-82f52370aca2\\">\\n  <booktitle>\\n    <mainbooktitle>a</mainbooktitle>\\n  </booktitle>\\n  <bookmeta>\\n    <shortdesc/>\\n    <author/>\\n    <source/>\\n    <category/>\\n    <keywords>\\n      <keyword/>\\n    </keywords>\\n    <prodinfo>\\n      <prodname product=\\"\\"/>\\n      <vrmlist>\\n        <vrm version=\\"\\"/>\\n      </vrmlist>\\n      <prognum/>\\n      <brand/>\\n    </prodinfo>\\n    <bookchangehistory>\\n      <approved>\\n        <revisionid/>\\n      </approved>\\n    </bookchangehistory>\\n    <bookrights>\\n      <copyrfirst>\\n        <year/>\\n      </copyrfirst>\\n      <bookowner/>\\n    </bookrights>\\n  </bookmeta>\\n  <frontmatter>\\n    <notices/>\\n    <booklists>\\n      <toc/>\\n    </booklists>\\n    <preface/>\\n  </frontmatter>\\n  <chapter href=\\"c_aaaa_e56ab0e797826adf7d4fef41f9c39fe1.dita\\" navtitle=\\"aaaa\\">\\n    <topicref href=\\"c_bbbb_e374c26206dc955160cecea10306509d.dita\\" navtitle=\\"bbbb\\"/>\\n  </chapter>\\n  <appendices/>\\n  <reltable>\\n    <relheader>\\n      <relcolspec/>\\n      <relcolspec/>\\n    </relheader>\\n    <relrow>\\n      <relcell/>\\n      <relcell/>\\n    </relrow>\\n    <relrow>\\n      <relcell/>\\n      <relcell/>\\n    </relrow>\\n  </reltable>\\n</bookmap>\\n<!--linted: 2019-06-25 at 21:04:32 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: bookmap -->\\n<!--docType: <!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_a_6b2bcb0e0a5337f3bb3b28099e892b3d.ditamap -->\\n<!--guid: GUID-8e2504aa-ea92-9307-7bd1-82f52370aca2 -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 929 -->\\n<!--project: all -->\\n<!--title: a -->\\n<!--definition: GUID-8e2504aa-ea92-9307-7bd1-82f52370aca2 -->\\n<!--labels: GUID-8e2504aa-ea92-9307-7bd1-82f52370aca2 GUID-d42dec6e-0ce9-ebc1-c018-e656df6c3a06 -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_e56ab0e797826adf7d4fef41f9c39fe1.dita"  => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-fa5dea13-6bbb-2d62-2a55-f5feefe9ae89\\">\\n  <title>aaaa</title>\\n  <conbody>\\n    <p>aaaa</p>\\n  </conbody>\\n</concept>\\n<!--linted: 2019-06-25 at 21:04:32 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_e56ab0e797826adf7d4fef41f9c39fe1.dita -->\\n<!--guid: GUID-fa5dea13-6bbb-2d62-2a55-f5feefe9ae89 -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 929 -->\\n<!--project: all -->\\n<!--title: aaaa -->\\n<!--definition: GUID-fa5dea13-6bbb-2d62-2a55-f5feefe9ae89 -->\\n<!--labels: GUID-fa5dea13-6bbb-2d62-2a55-f5feefe9ae89 ca -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_e374c26206dc955160cecea10306509d.dita"  => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-e9997c20-3dcf-6958-f762-09d8250bc53e\\">\\n  <title>bbbb</title>\\n  <conbody>\\n    <p id=\\"p1\\">bbbb</p>\\n  </conbody>\\n</concept>\\n<!--linted: 2019-06-25 at 21:04:31 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_e374c26206dc955160cecea10306509d.dita -->\\n<!--guid: GUID-e9997c20-3dcf-6958-f762-09d8250bc53e -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 929 -->\\n<!--project: all -->\\n<!--title: bbbb -->\\n<!--definition: p1 -->\\n<!--definition: GUID-e9997c20-3dcf-6958-f762-09d8250bc53e -->\\n<!--labels: GUID-e9997c20-3dcf-6958-f762-09d8250bc53e cb -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/a.dita"                                    => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_a_6b2bcb0e0a5337f3bb3b28099e892b3d.ditamap\\",\\n  targetType => \\"bookmap\\",\\n}, \\"SourceToTarget\\")",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/a.ditamap"                                 => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/a.ditamap\\",\\n  sourceDocType => \\"bookmap\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_6661b95b6e3802e892116df5a3307e8f.ditamap\\",\\n  targetType => \\"bookmap\\",\\n}, \\"SourceToTarget\\")",
  };

  changeFolderAndWriteFiles($f, $folder);                                       # Change folder and write files
 }

sub createSampleInputFilesForFixDitaRefsImproved4($)                            #P Create sample input files for fixing bookmap reference to a topic that did not get cut into  multiple pieces
 {my ($folder) = @_;                                                            # Folder to switch to
  my $f = {
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_6661b95b6e3802e892116df5a3307e8f.ditamap"  => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []>\\n<bookmap id=\\"GUID-2a901384-59f3-9fdb-de14-546a63d03dfa\\">\\n  <chapter href=\\"a.dita\\" navtitle=\\"aaaa\\"/>\\n</bookmap>\\n<!--linted: 2019-06-25 at 22:41:31 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: bookmap -->\\n<!--docType: <!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_6661b95b6e3802e892116df5a3307e8f.ditamap -->\\n<!--guid: GUID-2a901384-59f3-9fdb-de14-546a63d03dfa -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.ditamap -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 929 -->\\n<!--project: all -->\\n<!--title: a -->\\n<!--definition: GUID-2a901384-59f3-9fdb-de14-546a63d03dfa -->\\n<!--labels: GUID-2a901384-59f3-9fdb-de14-546a63d03dfa bm -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_e56ab0e797826adf7d4fef41f9c39fe1.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-fa5dea13-6bbb-2d62-2a55-f5feefe9ae89\\">\\n  <title>aaaa</title>\\n  <conbody>\\n    <p>aaaa</p>\\n  </conbody>\\n</concept>\\n<!--linted: 2019-06-25 at 22:41:31 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_e56ab0e797826adf7d4fef41f9c39fe1.dita -->\\n<!--guid: GUID-fa5dea13-6bbb-2d62-2a55-f5feefe9ae89 -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 929 -->\\n<!--project: all -->\\n<!--title: aaaa -->\\n<!--definition: GUID-fa5dea13-6bbb-2d62-2a55-f5feefe9ae89 -->\\n<!--labels: GUID-fa5dea13-6bbb-2d62-2a55-f5feefe9ae89 ca -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/a.dita"                                   => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_e56ab0e797826adf7d4fef41f9c39fe1.dita\\",\\n  targetType => \\"topic\\",\\n}, \\"SourceToTarget\\")",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/a.ditamap"                                => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/a.ditamap\\",\\n  sourceDocType => \\"bookmap\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_6661b95b6e3802e892116df5a3307e8f.ditamap\\",\\n  targetType => \\"bookmap\\",\\n}, \\"SourceToTarget\\")",
  };

  changeFolderAndWriteFiles($f, $folder);                                       # Change folder and write files
 }

sub createSampleImageTest($)                                                    #P Create sample input files for fixing bookmap reference to a topic that did not get cut into  multiple pieces
 {my ($folder) = @_;                                                            # Folder to switch to

  my $f = {
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_concept_1_476bcb2107e9e6c19659ac20ae123fe6.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-3984fb53-1379-7649-e0ac-272f39376156\\">\\n  <title>concept 1</title>\\n  <conbody>\\n    <image href=\\"png_31d0017136191f418bbef189d417802a.png\\"/>\\n    <image href=\\"../images/b.png\\"/>\\n  </conbody>\\n</concept>\\n\\n<!--linted: 2019-07-05 at 23:31:12 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_concept_1_476bcb2107e9e6c19659ac20ae123fe6.dita -->\\n<!--guid: GUID-3984fb53-1379-7649-e0ac-272f39376156 -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/concepts/c.dita -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: concept 1 -->\\n<!--definition: GUID-3984fb53-1379-7649-e0ac-272f39376156 -->\\n<!--labels: GUID-3984fb53-1379-7649-e0ac-272f39376156 c1 -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/png_31d0017136191f418bbef189d417802a"              => "{\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/download/images/a.png\\",\\n}",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/png_31d0017136191f418bbef189d417802a.png"          => "png image a\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/concepts/c.dita"                               => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/concepts/c.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_concept_1_476bcb2107e9e6c19659ac20ae123fe6.dita\\",\\n  targetType => \\"topic\\",\\n}, \\"SourceToTarget\\")",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/images/a.png"                                  => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/download/images/a.png\\",\\n  sourceDocType => \\"image\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/png_31d0017136191f418bbef189d417802a.png\\",\\n  targetType => \\"image\\",\\n}, \\"SourceToTarget\\")",
  };

  changeFolderAndWriteFiles($f, $folder);                                       # Change folder and write files
 }

sub createTestTopicFlattening($)                                                #P Create sample input files for testing topic flattening ratio reporting
 {my ($folder) = @_;                                                            # Folder to switch to

  my $f = {
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_2b1faeb8f74e670e20450cde864e2e46.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-707b18f0-a3e8-2566-446f-cdcfc467318c\\">\\n  <title/>\\n  <conbody/>\\n</concept>\\n<!--linted: 2019-07-06 at 22:01:57 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_2b1faeb8f74e670e20450cde864e2e46.dita -->\\n<!--guid: GUID-707b18f0-a3e8-2566-446f-cdcfc467318c -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/c1.dita -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--definition: GUID-707b18f0-a3e8-2566-446f-cdcfc467318c -->\\n<!--labels: GUID-707b18f0-a3e8-2566-446f-cdcfc467318c c -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/c1.dita"                             => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/c1.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_2b1faeb8f74e670e20450cde864e2e46.dita\\",\\n  targetType => \\"topic\\",\\n}, \\"SourceToTarget\\")",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/c2.dita"                             => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/c2.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_2b1faeb8f74e670e20450cde864e2e46.dita\\",\\n  targetType => \\"topic\\",\\n}, \\"SourceToTarget\\")",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/c3.dita"                             => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/c3.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_2b1faeb8f74e670e20450cde864e2e46.dita\\",\\n  targetType => \\"topic\\",\\n}, \\"SourceToTarget\\")",
  };

  changeFolderAndWriteFiles($f, $folder);                                       # Change folder and write files
 }

sub createTestReferencedToFlattenedTopic($)                                     #P Full reference to a topic that has been flattened
 {my ($folder) = @_;                                                            # Folder to switch to

  my $f = {
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_3119ee09e34375ed4d8a7a15274a9774.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-7b56e1e5-a8b5-7f09-73e5-e6ecb15d5e8f\\">\\n  <title>aaaa</title>\\n  <conbody>\\n    <p conref=\\"b.dita#c/p1\\"/>\\n  </conbody>\\n</concept>\\n\\n<!--linted: 2019-07-07 at 00:40:33 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_3119ee09e34375ed4d8a7a15274a9774.dita -->\\n<!--guid: GUID-7b56e1e5-a8b5-7f09-73e5-e6ecb15d5e8f -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: aaaa -->\\n<!--definition: GUID-7b56e1e5-a8b5-7f09-73e5-e6ecb15d5e8f -->\\n<!--labels: GUID-7b56e1e5-a8b5-7f09-73e5-e6ecb15d5e8f c -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_8b028dc2faaca88ac747b3776189d4a6.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-d003c721-d7e5-e4e8-3d84-ba7b4c80f56c\\">\\n  <title>aaaa</title>\\n  <conbody>\\n    <p id=\\"p1\\">pppp</p>\\n  </conbody>\\n</concept>\\n<!--linted: 2019-07-07 at 00:40:33 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_8b028dc2faaca88ac747b3776189d4a6.dita -->\\n<!--guid: GUID-d003c721-d7e5-e4e8-3d84-ba7b4c80f56c -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/c.ditamap -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: aaaa -->\\n<!--definition: p1 -->\\n<!--definition: GUID-d003c721-d7e5-e4e8-3d84-ba7b4c80f56c -->\\n<!--labels: GUID-d003c721-d7e5-e4e8-3d84-ba7b4c80f56c c -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/a.dita"                                   => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_3119ee09e34375ed4d8a7a15274a9774.dita\\",\\n  targetType => \\"topic\\",\\n}, \\"SourceToTarget\\")",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/b.dita"                                   => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/b.dita\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_8b028dc2faaca88ac747b3776189d4a6.dita\\",\\n  targetType => \\"topic\\",\\n}, \\"SourceToTarget\\")",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/c.ditamap"                                => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/c.ditamap\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_8b028dc2faaca88ac747b3776189d4a6.dita\\",\\n  targetType => \\"topic\\",\\n}, \\"SourceToTarget\\")",
  };

  changeFolderAndWriteFiles($f, $folder);                                       # Change folder and write files
 }

sub createTestReferenceToCutOutTopic($)                                         #P References from a topic that has been cut out to a topic that has been cut out
 {my ($folder) = @_;                                                            # Folder to switch to

  my $f = {
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []>\\n<bookmap id=\\"GUID-80a6bceb-0817-2a54-4d9e-ea67eed112b3\\">\\n  <booktitle>\\n    <mainbooktitle>a</mainbooktitle>\\n  </booktitle>\\n  <bookmeta>\\n    <shortdesc/>\\n    <author/>\\n    <source/>\\n    <category/>\\n    <keywords>\\n      <keyword/>\\n    </keywords>\\n    <prodinfo>\\n      <prodname product=\\"\\"/>\\n      <vrmlist>\\n        <vrm version=\\"\\"/>\\n      </vrmlist>\\n      <prognum/>\\n      <brand/>\\n    </prodinfo>\\n    <bookchangehistory>\\n      <approved>\\n        <revisionid/>\\n      </approved>\\n    </bookchangehistory>\\n    <bookrights>\\n      <copyrfirst>\\n        <year/>\\n      </copyrfirst>\\n      <bookowner/>\\n    </bookrights>\\n  </bookmeta>\\n  <frontmatter>\\n    <notices/>\\n    <booklists>\\n      <toc/>\\n    </booklists>\\n    <preface/>\\n  </frontmatter>\\n  <chapter href=\\"c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita\\" navtitle=\\"aaaa\\">\\n    <topicref href=\\"c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita\\" navtitle=\\"aaaa bbbb\\">\\n      <topicref href=\\"c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita\\" navtitle=\\"aaaa cccc\\"/>\\n    </topicref>\\n    <topicref href=\\"c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita\\" navtitle=\\"aaaa dddd\\"/>\\n  </chapter>\\n  <appendices/>\\n  <reltable>\\n    <relheader>\\n      <relcolspec/>\\n      <relcolspec/>\\n    </relheader>\\n    <relrow>\\n      <relcell/>\\n      <relcell/>\\n    </relrow>\\n    <relrow>\\n      <relcell/>\\n      <relcell/>\\n    </relrow>\\n  </reltable>\\n</bookmap>\\n\\n<!--linted: 2019-07-07 at 20:33:58 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: bookmap -->\\n<!--docType: <!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap -->\\n<!--guid: GUID-80a6bceb-0817-2a54-4d9e-ea67eed112b3 -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.xml -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: a -->\\n<!--definition: GUID-80a6bceb-0817-2a54-4d9e-ea67eed112b3 -->\\n<!--labels: GUID-80a6bceb-0817-2a54-4d9e-ea67eed112b3 GUID-621a0a8a-4af5-08b9-a9ba-ed7a27b59934 -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []>\\n<bookmap id=\\"GUID-21696006-94ec-4e53-78c5-24a93641a474\\">\\n  <booktitle>\\n    <mainbooktitle>b</mainbooktitle>\\n  </booktitle>\\n  <bookmeta>\\n    <shortdesc/>\\n    <author/>\\n    <source/>\\n    <category/>\\n    <keywords>\\n      <keyword/>\\n    </keywords>\\n    <prodinfo>\\n      <prodname product=\\"\\"/>\\n      <vrmlist>\\n        <vrm version=\\"\\"/>\\n      </vrmlist>\\n      <prognum/>\\n      <brand/>\\n    </prodinfo>\\n    <bookchangehistory>\\n      <approved>\\n        <revisionid/>\\n      </approved>\\n    </bookchangehistory>\\n    <bookrights>\\n      <copyrfirst>\\n        <year/>\\n      </copyrfirst>\\n      <bookowner/>\\n    </bookrights>\\n  </bookmeta>\\n  <frontmatter>\\n    <notices/>\\n    <booklists>\\n      <toc/>\\n    </booklists>\\n    <preface/>\\n  </frontmatter>\\n  <chapter href=\\"c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita\\" navtitle=\\"bbbb\\">\\n    <topicref href=\\"c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita\\" navtitle=\\"bbbb aaaa\\">\\n      <topicref href=\\"c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita\\" navtitle=\\"bbbb bbbb\\"/>\\n    </topicref>\\n    <topicref href=\\"c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita\\" navtitle=\\"bbbb cccc\\"/>\\n  </chapter>\\n  <appendices/>\\n  <reltable>\\n    <relheader>\\n      <relcolspec/>\\n      <relcolspec/>\\n    </relheader>\\n    <relrow>\\n      <relcell/>\\n      <relcell/>\\n    </relrow>\\n    <relrow>\\n      <relcell/>\\n      <relcell/>\\n    </relrow>\\n  </reltable>\\n</bookmap>\\n\\n<!--linted: 2019-07-07 at 20:33:58 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: bookmap -->\\n<!--docType: <!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_b_d2806ba589f908da1106574afd9db642.ditamap -->\\n<!--guid: GUID-21696006-94ec-4e53-78c5-24a93641a474 -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/b.xml -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: b -->\\n<!--definition: GUID-21696006-94ec-4e53-78c5-24a93641a474 -->\\n<!--labels: GUID-21696006-94ec-4e53-78c5-24a93641a474 GUID-b3f88460-8608-df56-bc6c-1215327bcc24 -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368\\">\\n  <title>aaaa</title>\\n  <conbody/>\\n</concept>\\n<!--linted: 2019-07-07 at 20:33:58 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita -->\\n<!--guid: GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368 -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.xml -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: aaaa -->\\n<!--definition: GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368 -->\\n<!--labels: GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368 a -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-f0c0e170-8128-10ef-045d-97602fdde76f\\">\\n  <title>aaaa bbbb</title>\\n  <conbody>\\n    <p conref=\\"b.xml#b/p1\\"/>\\n  </conbody>\\n</concept>\\n\\n<!--linted: 2019-07-07 at 20:33:58 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita -->\\n<!--guid: GUID-f0c0e170-8128-10ef-045d-97602fdde76f -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.xml -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: aaaa bbbb -->\\n<!--definition: GUID-f0c0e170-8128-10ef-045d-97602fdde76f -->\\n<!--labels: GUID-f0c0e170-8128-10ef-045d-97602fdde76f ab -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf\\">\\n  <title>aaaa cccc</title>\\n  <conbody>\\n    <p conref=\\"bb.xml#bb/p2\\"/>\\n  </conbody>\\n</concept>\\n\\n<!--linted: 2019-07-07 at 20:33:58 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita -->\\n<!--guid: GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.xml -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: aaaa cccc -->\\n<!--definition: GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf -->\\n<!--labels: GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf ac -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-68822563-d568-f418-38ae-f1c62cb4ac8d\\">\\n  <title>aaaa dddd</title>\\n  <conbody>\\n    <p conref=\\"b.xml#b/p3\\"/>\\n  </conbody>\\n</concept>\\n\\n<!--linted: 2019-07-07 at 20:33:58 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita -->\\n<!--guid: GUID-68822563-d568-f418-38ae-f1c62cb4ac8d -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/a.xml -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: aaaa dddd -->\\n<!--definition: GUID-68822563-d568-f418-38ae-f1c62cb4ac8d -->\\n<!--labels: GUID-68822563-d568-f418-38ae-f1c62cb4ac8d ad -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251\\">\\n  <title>bbbb</title>\\n  <conbody>\\n    <p id=\\"p1\\">1111</p>\\n  </conbody>\\n</concept>\\n<!--linted: 2019-07-07 at 20:33:58 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita -->\\n<!--guid: GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251 -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/b.xml -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: bbbb -->\\n<!--definition: p1 -->\\n<!--definition: GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251 -->\\n<!--labels: GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251 b -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc\\">\\n  <title>bbbb aaaa</title>\\n  <conbody/>\\n</concept>\\n<!--linted: 2019-07-07 at 20:33:58 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita -->\\n<!--guid: GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/b.xml -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: bbbb aaaa -->\\n<!--definition: GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc -->\\n<!--labels: GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc ba -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7\\">\\n  <title>bbbb bbbb</title>\\n  <conbody>\\n    <p id=\\"p2\\">2222</p>\\n  </conbody>\\n</concept>\\n<!--linted: 2019-07-07 at 20:33:58 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita -->\\n<!--guid: GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7 -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/b.xml -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: bbbb bbbb -->\\n<!--definition: p2 -->\\n<!--definition: GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7 -->\\n<!--labels: GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7 bb -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd\\">\\n  <title>bbbb cccc</title>\\n  <conbody>\\n    <p id=\\"p3\\">3333</p>\\n  </conbody>\\n</concept>\\n<!--linted: 2019-07-07 at 20:33:58 -->\\n<!--catalog: /home/phil/r/dita/dita-ot-3.1/catalog-dita.xml -->\\n<!--ditaType: concept -->\\n<!--docType: <!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Concept//EN\\" \\"concept.dtd\\" []> -->\\n<!--file: /home/phil/perl/cpan/DataEditXmlToDita/test/out/c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita -->\\n<!--guid: GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd -->\\n<!--header: <?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?> -->\\n<!--inputFile: /home/phil/perl/cpan/DataEditXmlToDita/test/in/b.xml -->\\n<!--lineNumber: Data::Edit::Xml::To::DitaVb /home/phil/perl/cpan/DataEditXmlToDita/lib/Data/Edit/Xml/To/DitaVb.pm 945 -->\\n<!--project: all -->\\n<!--title: bbbb cccc -->\\n<!--definition: p3 -->\\n<!--definition: GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd -->\\n<!--labels: GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd bc -->\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/a.xml"                                         => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/a.xml\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap\\",\\n  targetType => \\"bookmap\\",\\n}, \\"SourceToTarget\\")",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/targets/b.xml"                                         => "bless({\\n  source => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/in/b.xml\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"/home/phil/perl/cpan/DataEditXmlToDita/test/out/bm_b_d2806ba589f908da1106574afd9db642.ditamap\\",\\n  targetType => \\"bookmap\\",\\n}, \\"SourceToTarget\\")",
  };

  changeFolderAndWriteFiles($f, $folder);                                       # Change folder and write files
 }

sub createSampleOtherMeta($)                                                    #P Create sample data for othermeta reports
 {my ($out) = @_;                                                               # Folder

  package CreateSampleOtherMeta;
  use Carp;
  use Data::Dump qw(dump);
  use Data::Edit::Xml;
  use Data::Table::Text qw(:all);

  sub genMeta(%)                                                                # Generate meta data
   {my %m = @_;
    my @m;
    for my $n(sort keys %m)
     {my $c = $m{$n};
      push @m, qq(<othermeta name="$n" content="$c"/>);
     }
    join "\\n", @m;
   }

  sub genTopic($$$)                                                             # Generate a topic
   {my ($out, $name, $meta) = @_;

    my $c      = Data::Edit::Xml::ditaSampleConcept
     (title    => $name,
      metadata => $meta,
     );

    owf(fpe($out, $name, qw(dita)), $c->ditaPrettyPrintWithHeaders);
   }

  sub genMap($$$@)                                                              # Generate a bookmap
   {my ($out, $name, $meta, @chapters) = @_;

    my @r;
    for my $f(@chapters)
     {my $F = swapFilePrefix($f, $out);
      push @r, qq(<chapter href="$F"/>);
     }

    my $r = join "\\n", @r;

    my $b = Data::Edit::Xml::ditaSampleBookMap
     (chapters  => $r,
      metadata  => $meta,
      title     => $name,
     );

    owf(fpe($out, $name, qw(ditamap)), $b->ditaPrettyPrintWithHeaders);
   }

  clearFolder($out, 1e2);

  my %common = (aa=>q(AAAA), bb=>q(BBBB));

  my @topics =                                                                  # Topics
   (genTopic($out, q(ca), genMeta(%common, dd=>q(DD))),
    genTopic($out, q(cb), genMeta(%common, dd=>q(DD))),
   );

  genMap($out, q(b1), genMeta(%common, dd=>q(DD1111)), @topics);                # Bookmaps
  genMap($out, q(b2), genMeta(%common, dd=>q(DD2222)), @topics);
 } # createSampleOtherMeta

sub createTestOneNotRef($)                                                      #P One topic refernced and the other not
 {my ($folder) = @_;                                                            # Folder to switch to

  my $f = {
  "/home/phil/perl/cpan/DataEditXmlToDita/test/in/a.dita"    => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Task//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"ca\\">\\n  <title>aaaa</title>\\n  <conbody/>\\n</concept>\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/in/a.ditamap" => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE bookmap PUBLIC \\"-//OASIS//DTD DITA BookMap//EN\\" \\"bookmap.dtd\\" []>\\n<bookmap id=\\"bm\\">\\n  <chapter href=\\"a.dita\\" navtitle=\\"aaaa\\"/>\\n</bookmap>\\n",
  "/home/phil/perl/cpan/DataEditXmlToDita/test/in/b.dita"    => "<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>\\n<!DOCTYPE concept PUBLIC \\"-//OASIS//DTD DITA Task//EN\\" \\"concept.dtd\\" []>\\n<concept id=\\"cb\\">\\n  <title>bbbb</title>\\n  <conbody/>\\n</concept>\\n",
  };

  changeFolderAndWriteFiles($f, $folder);                                       # Change folder and write files
 }

sub createSampleTopicsReferencedFromBookMaps($)                                 #P The number of times a topic is referenced from a bookmap
 {my ($in) = @_;                                                                # Folder to create the files in
  my $d = fpd(currentDirectory, $in);

  owf(fpe($in, qw(m1 dita)), <<END);
<map id="m1">
  <title>Map 1</title>
  <chapter href="c1.dita"/>
</map>
END

  owf(fpe($in, qw(m2 dita)), <<END);
<map id="m2">
  <title>Map 1</title>
  <topicref href="c1.dita"/>
  <topicref href="c2.dita"/>
</map>
END

  owf(fpe($in, qw(c1 dita)), <<END);
<concept id="c1">
  <title>c1</title>
  <conbody>
    <image href="1.png"/>;
  </conbody>
</concept>
END
  owf(fpe($in, qw(c2 dita)), <<END);
<concept id="c2">
  <title>c2</title>
  <conbody>
    <image href="1.png"/>;
    <image href="2.png"/>;
  </conbody>
</concept>
END
  owf(fpe($in, qw(c3 dita)), <<END);
<concept id="c3">
  <title>c3</title>
  <conbody>
    <image href="1.png"/>;
    <image href="2.png"/>;
    <image href="3.png"/>;
  </conbody>
</concept>
END
 }

sub createSampleImageReferences($)                                              #P Good and bad image references
 {my ($in) = @_;                                                                # Folder to create the files in
  my $d    = fpd(currentDirectory, $in);

  owf(fpe($in, qq(c$_), q(dita)), <<END) for 1..3;
<concept id="c$_">
  <title>C$_</title>
  <conbody>
    <image href="good1.png"/>
    <image href="good1.png"/>
    <image href="good2.png"/>
    <image href="good2.png"/>
    <image href="bad1.png"/>
    <image href="bad1.png"/>
  </conbody>
</concept>
END

  owf(fpe($in, qw(good1 png)), <<END);
<image/>
END

  owf(fpe($in, qw(good2 png)), <<END);
<image/>
END
 }

sub createRequiredCleanUps($)                                                   #P Required clean ups report
 {my ($in) = @_;                                                                # Folder to create the files in
  my $d    = fpd(currentDirectory, $in);

  owf(fpe($in, qq(c1), q(dita)), <<END);
<concept id="c1">
  <title>C1_</title>
  <conbody>
    <required-cleanup>aaa</required-cleanup>
    <required-cleanup>bbb</required-cleanup>
    <required-cleanup>bbb</required-cleanup>
  </conbody>
</concept>
END

  owf(fpe($in, qq(c2), q(dita)), <<END);
<concept id="c2">
  <title>C2_</title>
  <conbody>
    <required-cleanup>aaa</required-cleanup>
    <required-cleanup>bbb</required-cleanup>
    <required-cleanup>ccc</required-cleanup>
    <required-cleanup>CCC</required-cleanup>
  </conbody>
</concept>
END
 }

sub createSoftConrefs($)                                                        #P Fix file part of conref even if the rest is invalid
 {my ($in) = @_;                                                                # Folder to create the files in
  my $d    = fpd(currentDirectory, $in);

  my $r = fpe(qw(c_12345678123456781234567812345678 dita));                     # Relocatable
  owf(fpf($in, q(folder), $r), <<END);
$conceptHeader
<concept id="c">
  <title>C1</title>
  <conbody>
    <p id="p1">aaa</p>
    <p id="p1">bbb</p>
    <p conref="#c/p1"/>    <!-- FAILS -->
    <p conref="#c/pp"/>    <!-- FAILS: No such id -->
  </conbody>
</concept>
END

  owf(fpe($in, qw(c dita)), <<END);
$conceptHeader
<concept id="c">
  <title>C2</title>
  <conbody>
    <p conref="$r#c/p1"/>
    <p conref="$r#c1/p1"/>   <!-- PASSES: wrong topic id but we ignore topic ids-->
    <p conref="$r#c/bad"/>   <!-- PASSES: no such id - SHOULD FAIL even though we are relocating -->
    <p conref="$r"/>
    <p conref="c.dta"/>      <!-- FAILS: no such file -->
    <p id="q1">aaa</p>
    <p conref="#c/q1"/>
  </conbody>
</concept>
END
 }

sub checkXrefStructure($$@)                                                     #P Check an output structure produced by Xrf
 {my ($x, $field, @folders) = @_;                                               # Cross references, field to check, folders to suppress
  my $s = nws dump($x->{$field});                                               # Structure to be tested
  for my $folder($x->inputFolder, @folders)                                     # Remove specified folder names from structure to be tested
   {$s =~ s($folder) ()gs;                                                      # Remove folder name from structure to be tested
   }
  eval $s;                                                                      # Recreate structure
 }

sub writeXrefStructure($$@)                                                     #P Write the test for an Xref structure
 {my ($x, $field, @folders) = @_;                                               # Cross referencer, field, names of the folders to suppress

  my $in = $x->inputFolder;

  my $s = nws(dump($x->{$field}) =~ s($in) ()gsr);                              # Field to be tested
     $s =~ s(\\],\\s+\\[) (],\\n    [)gs;
     $s =~ s(\\},\\s+\\{) (},\\n    {)gs;

  for my $folderName(@folders)                                                  # Remove specified folder names from structure to be tested
   {no strict qw(refs);
    my $folder = &{$folderName};                                                # Folder name
    $s =~ s($folder) ()gs;                                                      # Remove folder name from structure to be tested
   }

  my $f = join \', \', @folders;                                                  # Folders to remove
  my $t = <<END;                                                                # Format test
  is_deeply checkXrefStructure(\\$x, q($field), $f), $s;
END

  say STDERR $t;                                                                # Write test
 }

sub deleteVariableFields($)                                                     #P Remove time and other fields that do not affect the end results
 {my ($x) = @_;                                                                 # Cross referencer
  delete $x->{$_} for qw(timeEnded timeStart maximumNumberOfProcesses);         # Remove time fields
  delete $x->{$_} for qw(tagsTextsRatio);                                       # Remove floating fields
  removeFilePathsFromStructure($x);
 }

sub testReferenceChecking                                                       #P Test reference checking
 {my $folder = q(/home/phil/);
  my @names  = qw(aaa bbb ccc);
  my @ids    = map {q(p).$_}                   @names;
  my @files  = map {fpe($folder, $_, q(dita))} @names;

  my $xref = newXref
   (currentFolder  => q(/aaa),
    reports        => fpd(currentDirectory, qw(test resports)),
    topicIds       => {map {$files[$_]=>$names[$_]}      0..$#names},
    ids            => {map {$files[$_]=>{$ids[$_]=>1}}   0..$#names},
   );

  for my $i(0..$#names)                                                         # Create some references
   {my $j = ($i + 1) % $#names;
    $xref->references->{$files[0]}{q(../phil/).$names[$i].q(.dita#).$names[$i].q(/).$ids[$i]}++;
    $xref->references->{$files[1]}{q(../phil/).$names[$i].q(.dita#).$names[$i].q(/).$ids[$j]}++;
    $xref->references->{$files[2]}{q(../phil/).$names[$i].q(.dita#).$names[$j].q(/).$ids[$i]}++;
   }

  ok !oneBadRef($xref, q(/home/phil/aaa.dita), q(../phil/bbb.dita#bbb/pbbb));   # Test reference checking
  ok !oneBadRef($xref, q(/home/phil/aaa.dita), q(../phil/bbb.dita));
  ok !oneBadRef($xref, q(/home/phil/aaa.dita), q(#aaa/paaa));
  ok !oneBadRef($xref, q(/home/phil/aaa.dita), q(#./paaa));
  ok !oneBadRef($xref, q(/home/phil/aaa.dita), q(#paaa));

  is_deeply oneBadRef($xref, q(/home/phil/aaa.dita), q(../phil/bbb.dita#bbb/pccc)),
   ["No such id in target topic",
    "../phil/bbb.dita#bbb/pccc",
    "/home/phil/bbb.dita",
    "bbb",
    "pccc",
    "aaa",
    "bbb",
    "/home/phil/aaa.dita",
    "/home/phil/bbb.dita",
  ];
  is_deeply oneBadRef($xref, q(/home/phil/aaa.dita), q(../phil/bbb.dita#aaa/pbbb)),
   ["Topic id does not match",
    "../phil/bbb.dita#aaa/pbbb",
    "/home/phil/bbb.dita",
    "aaa",
    "pbbb",
    "aaa",
    "bbb",
    "/home/phil/aaa.dita",
    "/home/phil/bbb.dita",
  ];
  is_deeply oneBadRef($xref, q(/home/phil/aaa.dita), q(../phil/ddd.dita#bbb/pbbb)),
   ["No such file",
    "../phil/ddd.dita#bbb/pbbb",
    "/home/phil/ddd.dita",
    "bbb",
    "pbbb",
    "aaa",
    undef,
    "/home/phil/aaa.dita",
    "/home/phil/ddd.dita",
  ];
  is_deeply oneBadRef($xref, q(/home/phil/aaa.dita), q(../phil/ddd.dita)),
  [ "No such file",
    "../phil/ddd.dita",
    "../phil/ddd.dita",
    "",
    "",
    "",
    "",
    "/home/phil/aaa.dita",
    "/home/phil/ddd.dita",
  ];
  is_deeply oneBadRef($xref, q(/home/phil/aaa.dita), q(#./pbbb)),
   ["No such id in target topic",
    "#./pbbb",
    "/home/phil/aaa.dita",
    "aaa",
    "pbbb",
    "aaa",
    "aaa",
    "/home/phil/aaa.dita",
    "/home/phil/aaa.dita",
  ];
  is_deeply oneBadRef($xref, q(/home/phil/aaa.dita), q(#bbb/pbbb)),
   ["Topic id does not match",
    "#bbb/pbbb",
    "/home/phil/aaa.dita",
    "bbb",
    "pbbb",
    "aaa",
    "aaa",
    "/home/phil/aaa.dita",
    "/home/phil/aaa.dita",
  ];
  is_deeply oneBadRef($xref, q(/home/phil/aaa.dita), q(#bbb/ccc)),
   ["Topic id does not match",
    "#bbb/ccc",
    "/home/phil/aaa.dita",
    "bbb",
    "ccc",
    "aaa",
    "aaa",
    "/home/phil/aaa.dita",
    "/home/phil/aaa.dita",
  ];

 checkReferences($xref);                                                        # Report fixes required

 is_deeply $xref->fixRefs,
  {"/home/phil/bbb.dita" => {
                              "../phil/aaa.dita#aaa/pbbb" => 1,
                              "../phil/bbb.dita#bbb/paaa" => 1,
                              "../phil/ccc.dita#ccc/pbbb" => 1,
                            },
   "/home/phil/ccc.dita" => {
                              "../phil/aaa.dita#bbb/paaa" => 1,
                              "../phil/bbb.dita#aaa/pbbb" => 1,
                              "../phil/ccc.dita#bbb/pccc" => 1,
                            },
 };


 } # testReferenceChecking

&testReferenceChecking;

if (1) {                                                                        # Fix xrefs by title  - there should be just one so fixed
lll "Test 001";
  clearFolder($_, 420) for in, out, reportFolder;
  createSampleInputFilesBaseCase(in, 8);

  my $x = xref(inputFolder => in,
               reports     => reportFolder,
               html        => reportFolder);
  ok $x->statusLine eq q(Xref: 104 refs, 21 image refs, 14 first lines, 14 second lines, 8 duplicate ids, 4 duplicate topic ids, 4 invalid guid hrefs, 2 duplicate files, 2 tables, 1 External xrefs with no format=html, 1 External xrefs with no scope=external, 1 file failed to parse, 1 href missing);

  #lll $x->statusLine;
  #say STDERR writeXrefStructure($x, q(publicId), q(in));
  is_deeply checkXrefStructure($x, q(publicId), in),
   {"1.dita" => undef, "2.dita" => undef, "3.dita" => undef, "4.dita" => undef,
    "5.dita" => undef, "6.dita" => undef, "7.dita" => undef, "8.dita" => undef,
    "act1.dita" => undef, "act4.dita" => undef, "act5.dita" => undef,
    "map/bookmap3.ditamap" => undef,
    "map/bookmap.ditamap"  => undef, "map/bookmap2.ditamap" => undef,
    "act2.dita"  => "-//OASIS//DTD DITA Task//EN",
    "table.dita" => "-//OASIS//DTD DITA Task//EN", };

  ok readFile(fpe(reportFolder, qw(bad duplicate_topics_ids html))) =~ m(<tr><td>c2<td>)is;
  ok readFile(fpe(reportFolder, qw(bad duplicate_topics_ids txt)))  =~ m(1  c2)is;

  my $y = xref(inputFolder => in, reports=>reportFolder, fixBadRefs => 1, fixXrefsByTitle => 1);       # Update error counts
  ok $y->statusLine eq q(Xref: 103 refs, 21 image refs, 14 first lines, 14 second lines, 8 duplicate ids, 4 duplicate topic ids, 4 invalid guid hrefs, 2 duplicate files, 2 tables, 1 External xrefs with no format=html, 1 External xrefs with no scope=external, 1 file failed to parse, 1 href missing);

  is_deeply checkXrefStructure($y, q(fixedRefsGood)),
   [[\'Fixed by Gearhart Title Method\', "xref", "href",
     "act1.dita#c1/title", "act1.dita", "act2.dita"]];
 }

if (1) {                                                                        #
lll "Test 002";
  clearFolder($_, 420) for in, out, reportFolder;
  createSampleInputFilesBaseCase(in, 8);

  my $x = xref(inputFolder                        => in,
               requestAttributeNameAndValueCounts => 1,
               reports                            => reportFolder,
               addNavTitles                       => 1,
               deguidize                          => 1,
               deleteUnusedIds                    => 1);


  ok $x->statusLine eq q(Xref: 88 refs, 18 image refs, 14 first lines, 14 second lines, 8 duplicate ids, 4 duplicate topic ids, 4 invalid guid hrefs, 2 duplicate files, 2 tables, 1 External xrefs with no format=html, 1 External xrefs with no scope=external, 1 file failed to parse, 1 href missing);

  is_deeply checkXrefStructure($x, q(topicsReferencedFromBookMaps)),
    {
      #"act2.dita"            => { "act1.dita" => 1, "act9999.dita" => 1 },
      "map/bookmap.ditamap"  => {
                                   "act1.dita"     => 1,
                                   "act2.dita"     => 1,
                                   "map/9999.dita" => 1,
                                   "map/bbb.txt"   => 1,
                                   "map/r.txt"     => 1,
                                   "map/yyyy.dita" => 1,
                                 },
      "map/bookmap2.ditamap" => {
                                   "act1.dita"     => 1,
                                   "act2.dita"     => 1,
                                   "map/9999.dita" => 1,
                                   "map/bbb.txt"   => 1,
                                   "map/r.txt"     => 1,
                                   "map/zzzz.dita" => 1,
                                 },
      "map/bookmap3.ditamap" => { "act3.dita" => 1, "act4.dita" => 1, "act5.dita" => 1 },
    };

  is_deeply checkXrefStructure($x, q(imagesReferencedFromBookMaps)),
   {#"act2.dita" => {
    #   "act1.png"  => 1,
    #   "act2.png"  => 1,
    #   "guid-000"  => 1,
    #   "guid-9999" => 1,
    #   "guid-act1" => 1,                                 inputFolder
    # },
     "map/bookmap.ditamap" => {
       "act1.png"  => 1,
       "act2.png"  => 1,
       "guid-000"  => 1,
       "guid-9999" => 1,
       "guid-act1" => 1,
     },
     "map/bookmap2.ditamap" => {
       "act1.png"  => 1,
       "act2.png"  => 1,
       "guid-000"  => 1,
       "guid-9999" => 1,
       "guid-act1" => 1,
     },
   };
 }

if (1) {                                                                          # Check topic matching
lll "Test 003";
  clearFolder($_, 420) for in, out, reportFolder;
  createSampleInputFilesBaseCase(in, 8);

  my $x = xref(inputFolder   => in,
               reports       => reportFolder,
               deguidize     => 1,
               fixBadRefs    => 1,
               matchTopics   => 0.9,
               flattenFolder => out,
               html          => reportFolder);

  ok $x->statusLine eq q(Xref: 97 refs, 20 image refs, 14 first lines, 14 second lines, 8 duplicate ids, 4 duplicate topic ids, 4 invalid guid hrefs, 2 duplicate files, 2 tables, 1 External xrefs with no format=html, 1 External xrefs with no scope=external, 1 file failed to parse, 1 href missing);
  ok readFile(fpe($x->reportFolder, qw(similar byVocabulary txt))) =~ m(1\\s+8.*in/1\\.dita);
 }

if (1) {                                                                        # Relocated refs
lll "Test 004";
  clearFolder($_, 420) for qw(in out reports);
  createSampleInputFilesBaseCase(in, 8);

  my $x = xref(inputFolder              => in,
               reports                  => reportFolder,
               deguidize                => 1,
               fixBadRefs               => 1,
               fixRelocatedRefs         => 1,
               fixedFolder              => outFixed,
               flattenFolder            => out);

  ok $x->statusLine eq q(Xref: 97 refs, 20 image refs, 14 first lines, 14 second lines, 8 duplicate ids, 4 duplicate topic ids, 4 invalid guid hrefs, 2 duplicate files, 2 tables, 1 External xrefs with no format=html, 1 External xrefs with no scope=external, 1 file failed to parse, 1 href missing);

  my $table = $x->statusTable;

  ok index($table, <<END) == 0;
    Count  Condition
 1     97  refs
 2     20  image refs
 3     14  first lines
 4     14  second lines
 5      8  duplicate ids
 6      4  invalid guid hrefs
 7      4  duplicate topic ids
 8      2  tables
 9      2  duplicate files
10      1  file failed to parse
11      1  href missing
12      1  External xrefs with no format=html
13      1  External xrefs with no scope=external
END

  is_deeply checkXrefStructure($x, q(fixedRefsGood), in, targets),
   [[ "Deguidized reference", "image",    "href",   "guid-000",                                          "act1.dita",            "act1.dita", ],
    [ "Deguidized reference", "link",     "href",   "guid-000",                                          "act1.dita",            "act2.dita", ],
    [ "Deguidized reference", "topicref", "href",   "guid-000",                                          "act1.dita",            "map/bookmap.ditamap", ],
    [ "Deguidized reference", "topicref", "href",   "guid-000",                                          "act1.dita",            "map/bookmap2.ditamap", ],
    [ "Deguidized reference", "xref",     "href",   "guid-000#c1/title2",                                "act1.dita",            "act2.dita", ],
    [ "Deguidized reference", "xref",     "href",   "guid-000#guid-000/title",                           "act1.dita",            "act2.dita", ],
    [ "Deguidized reference", "xref",     "href",   "guid-000#guid-000/title2",                          "act1.dita",            "act2.dita", ],
    [ "Deguidized reference", "xref",     "href",   "guid-001#guid-001/title guid-000#guid-000/title",   "act1.dita",            "act2.dita", ],
  #  [ "Relocated",            "p",        "conref", "bookmap.ditamap",                                   "map/bookmap.ditamap",  "act2.dita", ],
  #  [ "Relocated",            "p",        "conref", "bookmap2.ditamap",                                  "map/bookmap2.ditamap", "act2.dita", ],
  ];


# &writeXrefStructure($x, qw(fixedRefs in targets));
 }

if (!onAws) {                                                                   # Pending in AWS because we have not fixed deguidize to run in parallel
lll "Test 005 - Add Navtitles";
  my $N = 8;

  clearFolder($_, 420) for in, out, reportFolder;
  createSampleInputFilesBaseCase(in, $N);

  my $x = xref(inputFolder                        => in,
               requestAttributeNameAndValueCounts => 1,
               reports                            => reportFolder,
               addNavTitles                       => 1,
               deguidize                          => 1,
               deleteUnusedIds                    => 1);

  #&writeXrefStructure($x, qw(badNavTitles in));

  is_deeply checkXrefStructure($x, q(badNavTitles), in, targets),
   [["No title for target",  "chapter href=\\"yyyy.dita\\"",     "map/yyyy.dita",  "map/bookmap.ditamap"],
    ["No title for target",  "topicref href=\\"../map/r.txt\\"", "map/r.txt",      "map/bookmap.ditamap"],
    ["No title for target",  "topicref href=\\"9999.dita\\"",    "map/9999.dita",  "map/bookmap.ditamap"],
    ["No title for target",  "topicref href=\\"bbb.txt\\"",      "map/bbb.txt",    "map/bookmap.ditamap"],
    ["No file for guid",     "topicref href=\\"guid-888\\"",      undef,           "map/bookmap.ditamap"],
    ["No file for guid",     "topicref href=\\"guid-999\\"",      undef,           "map/bookmap.ditamap"],
    ["No title for target",  "chapter href=\\"zzzz.dita\\"",     "map/zzzz.dita",  "map/bookmap2.ditamap"],
    ["No title for target",  "topicref href=\\"../map/r.txt\\"", "map/r.txt",      "map/bookmap2.ditamap"],
    ["No title for target",  "topicref href=\\"9999.dita\\"",    "map/9999.dita",  "map/bookmap2.ditamap"],
    ["No title for target",  "topicref href=\\"bbb.txt\\"",      "map/bbb.txt",    "map/bookmap2.ditamap"],
    ["No file for guid",     "topicref href=\\"guid-888\\"",      undef,           "map/bookmap2.ditamap"],
    ["No file for guid",     "topicref href=\\"guid-999\\"",      undef,           "map/bookmap2.ditamap"],
    ["No title for target",  "chapter href=\\"../act3.dita\\"",  "act3.dita",      "map/bookmap3.ditamap"],
    ["No title for target",  "chapter href=\\"../act4.dita\\"",  "act4.dita",      "map/bookmap3.ditamap"],
    ["No title for target",  "chapter href=\\"../act5.dita\\"",  "act5.dita",      "map/bookmap3.ditamap"]];

  #&writeXrefStructure($x, qw(goodNavTitles in targets)); exit;

  my $y = xref(inputFolder                        => in,
               requestAttributeNameAndValueCounts => 1,
               reports                            => reportFolder,
               addNavTitles                       => 1,
               deguidize                          => 1,
               fixBadRefs                         => 1);

  is_deeply checkXrefStructure($y, q(goodNavTitles), in, targets),
   [[ "../act1.dita", "All Timing Codes Begin Here", "act1.dita", "map/bookmap.ditamap",  ],
    [ "../act1.dita", "All Timing Codes Begin Here", "act1.dita", "map/bookmap.ditamap",  ],
    [ "../act1.dita", "All Timing Codes Begin Here", "act1.dita", "map/bookmap2.ditamap", ],
    [ "../act1.dita", "All Timing Codes Begin Here", "act1.dita", "map/bookmap2.ditamap", ],
    [ "../act2.dita", "Jumping Through Hops",        "act2.dita", "map/bookmap.ditamap",  ],
    [ "../act2.dita", "Jumping Through Hops",        "act2.dita", "map/bookmap2.ditamap", ], ];

  my $r = fpe($x->reports, qw(count attributeNamesAndValues txt));
  ok -e $r && index(readFile($r), <<END) > 0;
Summary_of_column_Attribute
   Count  Attribute
1     98  href
2     29  id
3     20  conref
4      8  xtrf
5      2  navtitle
6      1  cols
7      1  format
END
 }
else
 {ok 1 for 1..3
 }

if (0) {                                                                        # Max zoom in - fails after upgrade to html reports
lll "Test 006";
  my $N = 8;

  clearFolder($_, 420) for in, out, reports;
  createSampleInputFiles(in, $N);

  my $x = xref(inputFolder => in,
               maxZoomIn   => {bad=>q(Bad), good=>q(Good)});

  is_deeply checkXrefStructure($x, q(maxZoomOut)),
   {"1.dita"               => { data => { bad => 3, good => 4 }, title => "Concept 1 refers to 2" },
    "2.dita"               => { data => { bad => 3, good => 4 }, title => "Concept 2 refers to 3" },
    "3.dita"               => { data => { bad => 3, good => 4 }, title => "Concept 3 refers to 4" },
    "4.dita"               => { data => { bad => 3, good => 4 }, title => "Concept 4 refers to 5" },
    "5.dita"               => { data => { bad => 3, good => 4 }, title => "Concept 5 refers to 6" },
    "6.dita"               => { data => { bad => 3, good => 4 }, title => "Concept 6 refers to 7" },
    "7.dita"               => { data => { bad => 3, good => 4 }, title => "Concept 7 refers to 8" },
    "8.dita"               => { data => { bad => 3, good => 4 }, title => "Concept 8 refers to 1" },
    "act1.dita"            => { data => {}, title => "All Timing Codes Begin Here" },
    "act2.dita"            => { data => {}, title => "Jumping Through Hops" },
    "act4.dita"            => { data => {}, title => undef },
    "act5.dita"            => { data => {}, title => undef },
    "map/bookmap.ditamap"  => { data => {}, title => "Test" },
    "map/bookmap2.ditamap" => { data => {}, title => "Test 2" },
    "map/bookmap3.ditamap" => { data => {}, title => "Test 3" },
    "table.dita"           => { data => {}, title => "Tables" },
   };
 }

if (1) {                                                                        # fixedFolder
lll "Test 007";
  clearFolder($_, 1e3) for in, out, outFixed, reportFolder;
  createSampleInputFilesFixFolder(in);

  my $x = xref(inputFolder => in,
               reports     => reportFolder,
               fixBadRefs  => 1,
               fixedFolder => outFixed);

  ok $x->statusLine eq q(Xref: 2 refs, 2 second lines);
  my @files = searchDirectoryTreesForMatchingFiles(outFixed, q(dita));

  ok @files == 2;

  ok nws(readFile($files[0])) eq nws(<<END);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE reference PUBLIC "-//PHIL//DTD DITA Task//EN" "concept.dtd" []>
<concept id="c1">
  <title>Concept 1 which refers to concept 2</title>
  <conbody>
    <p conref="2.dita#c2/p1"/>
    <p conref="2.dita#c2/p2"/>
    <p xtrf="3.dita#c2/p1"/>
    <xref href="2.dita#c2/p1"/>
    <xref href="2.dita#c2/p2"/>
    <xref xtrf="3.dita#c2/p1"/>
  </conbody>
</concept>
END

#  &writeXrefStructure($x, qw(fixedRefsBad));

  is_deeply checkXrefStructure($x, q(fixedRefsBad)),
   [["No such target", "p",    "conref", "3.dita#c2/p1", "1.dita"],
    ["No such target", "xref", "href",   "3.dita#c2/p1", "1.dita"]];
 }

if (0) {                                                                        # ltgt
lll "Test 008";
  clearFolder($_, 1e3) for in, reports;
  createSampleInputFilesLtGt(in);

  my $x = xref(inputFolder => in, reports => reportFolder);
  my $r = readFile(fpe($x->reports, qw(count ltgt txt)));
  ok $r =~ m(1\\s*1\\s*aaa);
  ok $r =~ m(2\\s*1\\s*bbb);
 }

if (1) {                                                                        # fixDitaRefs using target files to locate flattened files
lll "Test 009";
  clearFolder(tests, 111);
  createSampleInputFilesForFixDitaRefsImproved1(tests);

  my $x = xref                                                                  # Fix with statistics showing the scale of the problem
   (inputFolder  => out,
    reports      => reportFolder,
    fixBadRefs   => 1,
    fixDitaRefs  => targets,
    fixedFolder  => outFixed,
    );

  ok !$x->errors;

  is_deeply checkXrefStructure($x, q(inputFileToTargetTopics), tests),
   {"in/a.dita"     => {"c_aaaa_ca202b3f0a58c67675f9704a32546cea.dita" => 1},
    "in/ab.ditamap" => {"bm_4ef751d67c53ac33272c3bbe16284b0d.ditamap"  => 1},
    "in/b.dita"     => {"c_aaaa_ca202b3f0a58c67675f9704a32546cea.dita" => 1}
   };

  is_deeply checkXrefStructure($x, q(originalSourceFileAndIdToNewFile), tests),
   {"in/a.dita"     => {"GUID-1581d732-b13a-edf0-2651-220a78f1c0fa" => "c_aaaa_ca202b3f0a58c67675f9704a32546cea.dita"},
    "in/ab.ditamap" => {"GUID-18c89db5-781b-666a-f24a-fbafa6d70733" => "bm_4ef751d67c53ac33272c3bbe16284b0d.ditamap"},
    "in/b.dita"     => {"GUID-1581d732-b13a-edf0-2651-220a78f1c0fa" => "c_aaaa_ca202b3f0a58c67675f9704a32546cea.dita"}
   };

  is_deeply checkXrefStructure($x, q(targetTopicToInputFiles), tests),
   {"bm_4ef751d67c53ac33272c3bbe16284b0d.ditamap"  => {"in/ab.ditamap" => 1},
    "c_aaaa_ca202b3f0a58c67675f9704a32546cea.dita" => {"in/a.dita" => 1, "in/b.dita" => 1}
   };

  my  $y = xref(inputFolder => outFixed, reports => reportFolder);              # Check results
  ok !$y->errors;
 }

if (1) {                                                                        # fixDitaRefs using target files to resolve conrefs to renamed files
lll "Test 010";
  clearFolder(tests, 111);
  createSampleInputFilesForFixDitaRefsImproved2(tests);

  my $y = xref(inputFolder => out, reports => reportFolder);                    # Check results without fixes
  ok $y->statusLine eq q(Xref: 1 ref);

  my $x = xref
   (inputFolder => out,
    reports     => reportFolder,
    fixBadRefs  => 1,
    fixDitaRefs => targets,
    fixedFolder => outFixed);

  ok !$x->errors;

  is_deeply checkXrefStructure($x, q(inputFileToTargetTopics), tests),
   {"in/a.dita" => {"c_aaaa_c8e30fbb422819ab92e1752ca50bb158.dita"=>1},
    "in/b.dita" => {"c_bbbb_e374c26206dc955160cecea10306509d.dita"=>1}
   };

  is_deeply checkXrefStructure($x, q(originalSourceFileAndIdToNewFile),tests),
   {"in/a.dita" => {"GUID-48fb251a-9a88-3bcc-d81b-301f426ed439" => "c_aaaa_c8e30fbb422819ab92e1752ca50bb158.dita"},
    "in/b.dita" => {"GUID-e9997c20-3dcf-6958-f762-09d8250bc53e" => "c_bbbb_e374c26206dc955160cecea10306509d.dita",
                    "p1"                                        => "c_bbbb_e374c26206dc955160cecea10306509d.dita"}
   };

  is_deeply checkXrefStructure($x, q(targetTopicToInputFiles), tests),
   {"c_aaaa_c8e30fbb422819ab92e1752ca50bb158.dita" => {"in/a.dita" => 1},
    "c_bbbb_e374c26206dc955160cecea10306509d.dita" => {"in/b.dita" => 1}
   };
 }

if (1) {                                                                        #Txref fixDitaRefs in bookmaps to topics that were cut into multiple pieces
lll "Test 011";
  clearFolder(tests, 111);
  createSampleInputFilesForFixDitaRefsImproved3(tests);

  my $y = xref(inputFolder => out, reports => reportFolder);                    # Check results without fixes
  ok $y->statusLine eq q(Xref: 1 ref);

  my $x = xref
   (inputFolder => out,
    reports     => reportFolder,
    fixBadRefs  => 1,
    fixDitaRefs => targets,
    fixedFolder => outFixed);

  ok !$x->errors;
 }

if (1) {                                                                        # fixDitaRefs in bookmaps to a topics that was not cut into multiple pieces
lll "Test 012";
  clearFolder(tests, 111);
  createSampleInputFilesForFixDitaRefsImproved4(tests);

  my $y = xref(inputFolder => out, reports => reportFolder);                    # Check results without fixes
  ok $y->statusLine eq q(Xref: 1 ref);

  my $x = xref
   (inputFolder => out,
    reports     => reportFolder,
    fixBadRefs  => 1,
    fixDitaRefs => targets,
    fixedFolder => outFixed);

  ok !$x->errors;

  ok int(1e2 * $y->tagsTextsRatio) == 233;
 }

if (1) {                                                                        # Images
lll "Test 013";
  clearFolder(tests, 111);
  createSampleImageTest(tests);

  my $x = xref
   (inputFolder => out,
    reports     => reportFolder,
    fixBadRefs  => 1,
    fixDitaRefs => targets,
    fixedFolder => outFixed);

  ok $x->statusLine eq q(Xref: 1 image ref, 1 ref);

  my ($file) = keys $x->missingImageFiles->%*;
  ok $file && $file =~ m(/images/b.png\\Z);
 }

if (1) {                                                                        # Test topic flattening ratio reporting
lll "Test 014";
  clearFolder(tests, 111);
  createTestTopicFlattening(tests);

  my $x = xref
   (inputFolder => out,
    reports     => reportFolder,
    fixBadRefs  => 1,
    fixDitaRefs => targets,
    fixedFolder => outFixed);

  ok $x->topicsFlattened       == 3;
  ok $x->topicFlatteningFactor == 3;

  is_deeply checkXrefStructure($x, q(topicFlattening), in, targets),
   { "c_2b1faeb8f74e670e20450cde864e2e46.dita" =>
     [ "c1.dita", "c2.dita", "c3.dita", ],
   };
 }

#latestTest:;
if (1) {                                                                        # References to flattened files
lll "Test 016";
  clearFolder(tests, 111);
  createTestReferencedToFlattenedTopic(tests);

  my $x = xref(inputFolder => out, reports => reportFolder);
  ok $x->statusLine eq q(Xref: 1 ref);
  is_deeply checkXrefStructure($x, q(fixedRefsGood), in, targets), [];

  my $y = xref
   (inputFolder => out,
    reports     => reportFolder,
    fixBadRefs  => 1,
    fixDitaRefs => targets,
    fixedFolder => outFixed);

  ok $y->topicsFlattened == 2;
  ok $y->topicFlatteningFactor == 2;

  is_deeply checkXrefStructure($y, q(fixedRefsGood), in, targets),
   [["Unique target for file ref", "p", "conref", "b.dita#c/p1",
     "c_aaaa_8b028dc2faaca88ac747b3776189d4a6.dita",
     "c_aaaa_3119ee09e34375ed4d8a7a15274a9774.dita", "a.dita"]];

  ok !$y->errors;
  is_deeply checkXrefStructure($y, q(fixedRefsGood), in, targets),
    [["Unique target for file ref", "p", "conref", "b.dita#c/p1",
      "c_aaaa_8b028dc2faaca88ac747b3776189d4a6.dita",
      "c_aaaa_3119ee09e34375ed4d8a7a15274a9774.dita", "a.dita"]];

 }

#latestTest:;
if (1) {                                                                        # References from a topic that has been cut out to a topic that has been cut out
lll "Test 017";
  clearFolder(tests, 111);
  createTestReferenceToCutOutTopic(tests);

  my $x = xref
   (inputFolder => out,
    reports     => reportFolder,
    fixBadRefs  => 1,
    fixDitaRefs => targets,
    fixedFolder => outFixed);

  ok $x->statusLine eq q(Xref: 1 ref);

  is_deeply checkXrefStructure($x, q(inputFileToTargetTopics),          in, targets), { "a.xml" => { "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita" => 1, "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => 1, "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => 1, "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => 1, }, "b.xml" => { "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita" => 1, "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => 1, "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => 1, "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => 1, }, };
  is_deeply checkXrefStructure($x, q(targetTopicToInputFiles),          in, targets), { "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita" => { "a.xml" => 1, }, "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { "a.xml" => 1, }, "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { "a.xml" => 1, }, "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { "a.xml" => 1, }, "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita" => { "b.xml" => 1, }, "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => { "b.xml" => 1, }, "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => { "b.xml" => 1, }, "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => { "b.xml" => 1, }, };
  is_deeply checkXrefStructure($x, q(sourceTopicToTargetBookMap),       in, targets), { "a.xml" => bless({ source => "a.xml", sourceDocType => "concept", target => "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap", targetType => "bookmap", }, "Bookmap"), "b.xml" => bless({ source => "b.xml", sourceDocType => "concept", target => "bm_b_d2806ba589f908da1106574afd9db642.ditamap", targetType => "bookmap", }, "Bookmap"), };
  is_deeply checkXrefStructure($x, q(topicFlattening),                  in, targets), {};
  is_deeply checkXrefStructure($x, q(originalSourceFileAndIdToNewFile), in, targets), { "a.xml" => { "GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf" => "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita", "GUID-68822563-d568-f418-38ae-f1c62cb4ac8d" => "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita", "GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368" => "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita", "GUID-f0c0e170-8128-10ef-045d-97602fdde76f" => "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita", }, "b.xml" => { "GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd" => "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita", "GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc" => "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita", "GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251" => "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita", "GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7" => "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita", "p1" => "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita", "p2" => "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita", "p3" => "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita", }, };

  #dumpFile(q(/home/phil/z/xref.data), deleteVariableFields($x)); exit;
  is_deeply deleteVariableFields($x), do {
do {
  my $a = bless({
    addNavTitles                         => undef,
    allowUniquePartialMatches            => undef,
    attributeCount                       => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => { href => 4, id => 1, navtitle => 4, product => 1, version => 1 },
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => { href => 4, id => 1, navtitle => 4, product => 1, version => 1 },
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => { id => 1 },
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { conref => 1, id => 1 },
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { conref => 1, id => 1 },
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { conref => 1, id => 1 },
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => { id => 2 },
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => { id => 1 },
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => { id => 2 },
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => { id => 2 },
                                            },
    attributeNamesAndValuesCount         => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => {
                                                                                                       href => {
                                                                                                         "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => 1,
                                                                                                         "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => 1,
                                                                                                         "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => 1,
                                                                                                         "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => 1,
                                                                                                       },
                                                                                                       id => { "GUID-80a6bceb-0817-2a54-4d9e-ea67eed112b3" => 1 },
                                                                                                       navtitle => { "aaaa" => 1, "aaaa bbbb" => 1, "aaaa cccc" => 1, "aaaa dddd" => 1 },
                                                                                                     },
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => {
                                                                                                       href => {
                                                                                                         "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => 1,
                                                                                                         "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => 1,
                                                                                                         "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => 1,
                                                                                                         "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => 1,
                                                                                                       },
                                                                                                       id => { "GUID-21696006-94ec-4e53-78c5-24a93641a474" => 1 },
                                                                                                       navtitle => { "bbbb" => 1, "bbbb aaaa" => 1, "bbbb bbbb" => 1, "bbbb cccc" => 1 },
                                                                                                     },
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => { id => { "GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368" => 1 } },
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => {
                                                                                                       conref => { p1 => 1 },
                                                                                                       id => { "GUID-f0c0e170-8128-10ef-045d-97602fdde76f" => 1 },
                                                                                                     },
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => {
                                                                                                       conref => { p2 => 1 },
                                                                                                       id => { "GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf" => 1 },
                                                                                                     },
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => {
                                                                                                       conref => { p3 => 1 },
                                                                                                       id => { "GUID-68822563-d568-f418-38ae-f1c62cb4ac8d" => 1 },
                                                                                                     },
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => {
                                                                                                       id => { "GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251" => 1, "p1" => 1 },
                                                                                                     },
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => { id => { "GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc" => 1 } },
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => {
                                                                                                       id => { "GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7" => 1, "p2" => 1 },
                                                                                                     },
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => {
                                                                                                       id => { "GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd" => 1, "p3" => 1 },
                                                                                                     },
                                            },
    author                               => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap" => "",
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap" => "",
                                            },
    badGuidHrefs                         => {},
    badNavTitles                         => {},
    badReferencesCount                   => 3,
    badTables                            => [],
    badXml1                              => {},
    badXml2                              => {},
    baseFiles                            => {},
    baseTag                              => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => "bookmap",
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => "bookmap",
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => "concept",
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => "concept",
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => "concept",
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => "concept",
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => "concept",
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => "concept",
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => "concept",
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => "concept",
                                            },
    bookMapRefs                          => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap" => {
                                                                                                   "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => { aaaa => 1 },
                                                                                                   "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { "aaaa bbbb" => 1 },
                                                                                                   "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { "aaaa cccc" => 1 },
                                                                                                   "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { "aaaa dddd" => 1 },
                                                                                                 },
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap" => {
                                                                                                   "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => { bbbb => 1 },
                                                                                                   "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => { "bbbb aaaa" => 1 },
                                                                                                   "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => { "bbbb bbbb" => 1 },
                                                                                                   "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => { "bbbb cccc" => 1 },
                                                                                                 },
                                            },
    changeBadXrefToPh                    => undef,
    classificationMaps                   => undef,
    conRefs                              => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => {},
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => {},
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { p1 => { p => 1 } },
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { p2 => { p => 1 } },
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { p3 => { p => 1 } },
                                            },
    createReports1                       => [
                                              "reportXml1",
                                              "reportXml2",
                                              "reportDuplicateIds",
                                              "reportDuplicateTopicIds",
                                              "reportNoHrefs",
                                              "reportTables",
                                              "reportParseFailed",
                                              "reportAttributeCount",
                                              "reportLtGt",
                                              "reportTagCount",
                                              "reportTagsAndTextsCount",
                                              "reportDocTypeCount",
                                              "reportFileExtensionCount",
                                              "reportFileTypes",
                                              "reportValidationErrors",
                                              "reportGuidHrefs",
                                              "reportExternalXrefs",
                                              "reportTopicDetails",
                                              "reportTopicReuse",
                                              "reportMd5Sum",
                                              "reportOlBody",
                                              "reportHrefUrlEncoding",
                                              "reportFixRefs",
                                              "reportSourceFiles",
                                              "reportOtherMeta",
                                              "createSubjectSchemeMap",
                                              "reportTopicsNotReferencedFromBookMaps",
                                              "reportTableDimensions",
                                              "reportExteriorMaps",
                                              "createClassificationMaps",
                                              "reportIdRefs",
                                              "reportEmptyTopics",
                                              "reportConRefMatching",
                                              "reportPublicIds",
                                              "reportRequiredCleanUps",
                                            ],
    createReports2                       => ["removeUnusedIds", "reportImages"],
    currentFolder                        => "",
    deguidize                            => undef,
    deleteUnusedIds                      => 0,
    docType                              => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => "bookmap",
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => "bookmap",
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => "concept",
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => "concept",
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => "concept",
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => "concept",
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => "concept",
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => "concept",
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => "concept",
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => "concept",
                                            },
    duplicateIds                         => {},
    duplicateTopicIds                    => {},
    emptyTopics                          => {
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => 1,
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => 1,
                                            },
    errors                               => 1,
    exteriorMaps                         => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap" => 1,
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap" => 1,
                                            },
    fileExtensions                       => [".dita", ".ditamap", ".xml", ".fodt"],
    fixBadRefs                           => 1,
    fixDitaRefs                          => "targets",
    fixedFolder                          => "",
    fixedFolderTemp                      => "",
    fixedRefsBad                         => [
                                              [
                                                "No such target",
                                                "p",
                                                "conref",
                                                "p2",
                                                "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita",
                                                "a.xml",
                                              ],
                                            ],
    fixedRefsGB                          => [],
    fixedRefsGood                        => [
                                              [
                                                "Unique target for file ref",
                                                "p",
                                                "conref",
                                                "p1",
                                                "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita",
                                                "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita",
                                                "a.xml",
                                              ],
                                              [
                                                "Unique target for file ref",
                                                "p",
                                                "conref",
                                                "p3",
                                                "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita",
                                                "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita",
                                                "a.xml",
                                              ],
                                            ],
    fixedRefsNoAction                    => [],
    fixRefs                              => {
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { p1 => 1 },
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { p2 => 1 },
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { p3 => 1 },
                                            },
    fixRelocatedRefs                     => undef,
    fixXrefsByTitle                      => undef,
    flattenFiles                         => {},
    flattenFolder                        => undef,
    getFileUrl                           => "client.pl?getFile=",
    goodImageFiles                       => {},
    goodNavTitles                        => {},
    guidHrefs                            => {},
    guidToFile                           => {},
    hrefUrlEncoding                      => {},
    html                                 => undef,
    idNotReferenced                      => {
                                              "b.xml" => {},
                                              "bb.xml" => {},
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap" => { "GUID-80a6bceb-0817-2a54-4d9e-ea67eed112b3" => 1 },
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap" => { "GUID-21696006-94ec-4e53-78c5-24a93641a474" => 1 },
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita" => { "GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368" => 1 },
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { "GUID-f0c0e170-8128-10ef-045d-97602fdde76f" => 1 },
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { "GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf" => 1 },
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { "GUID-68822563-d568-f418-38ae-f1c62cb4ac8d" => 1 },
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita" => { "GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251" => 1, "p1" => 1 },
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => { "GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc" => 1 },
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => { "GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7" => 1, "p2" => 1 },
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => { "GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd" => 1, "p3" => 1 },
                                            },
    idReferencedCount                    => { "b.xml" => { p1 => 1, p3 => 1 }, "bb.xml" => { p2 => 1 } },
    ids                                  => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => { "GUID-80a6bceb-0817-2a54-4d9e-ea67eed112b3" => 1 },
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => { "GUID-21696006-94ec-4e53-78c5-24a93641a474" => 1 },
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => { "GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368" => 1 },
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { "GUID-f0c0e170-8128-10ef-045d-97602fdde76f" => 1 },
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { "GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf" => 1 },
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { "GUID-68822563-d568-f418-38ae-f1c62cb4ac8d" => 1 },
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => { "GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251" => 1, "p1" => 1 },
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => { "GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc" => 1 },
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => { "GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7" => 1, "p2" => 1 },
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => { "GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd" => 1, "p3" => 1 },
                                            },
    idsRemoved                           => {
                                              "GUID-21696006-94ec-4e53-78c5-24a93641a474" => 1,
                                              "GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd" => 1,
                                              "GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf" => 1,
                                              "GUID-68822563-d568-f418-38ae-f1c62cb4ac8d" => 1,
                                              "GUID-80a6bceb-0817-2a54-4d9e-ea67eed112b3" => 1,
                                              "GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc" => 1,
                                              "GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251" => 1,
                                              "GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368" => 1,
                                              "GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7" => 1,
                                              "GUID-f0c0e170-8128-10ef-045d-97602fdde76f" => 1,
                                            },
    idTags                               => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => { "GUID-80a6bceb-0817-2a54-4d9e-ea67eed112b3" => ["bookmap"] },
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => { "GUID-21696006-94ec-4e53-78c5-24a93641a474" => ["bookmap"] },
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => { "GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368" => ["concept"] },
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { "GUID-f0c0e170-8128-10ef-045d-97602fdde76f" => ["concept"] },
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { "GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf" => ["concept"] },
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { "GUID-68822563-d568-f418-38ae-f1c62cb4ac8d" => ["concept"] },
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => {
                                                                                                       "GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251" => ["concept"],
                                                                                                       "p1" => ["p"],
                                                                                                     },
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => { "GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc" => ["concept"] },
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => {
                                                                                                       "GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7" => ["concept"],
                                                                                                       "p2" => ["p"],
                                                                                                     },
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => {
                                                                                                       "GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd" => ["concept"],
                                                                                                       "p3" => ["p"],
                                                                                                     },
                                            },
    images                               => {},
    imagesReferencedFromBookMaps         => {},
    imagesReferencedFromTopics           => {
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => {},
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => {},
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => {},
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => {},
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => {},
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => {},
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => {},
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => {},
                                            },
    imagesToRefferingBookMaps            => {},
    indexedWords                         => {},
    indexWords                           => undef,
    indexWordsFolder                     => undef,
    inputFiles                           => [
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap",
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap",
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita",
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita",
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita",
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita",
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita",
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita",
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita",
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita",
                                            ],
    inputFileToTargetTopics              => {
                                              "a.xml" => {
                                                           "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => 1,
                                                           "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => 1,
                                                           "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => 1,
                                                           "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => 1,
                                                         },
                                              "b.xml" => {
                                                           "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => 1,
                                                           "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => 1,
                                                           "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => 1,
                                                           "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => 1,
                                                         },
                                            },
    inputFolder                          => "",
    inputFolderImages                    => {
                                              bm_a_9d0a9f8e0ac234de9e22c19054b6e455        => "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap",
                                              bm_b_d2806ba589f908da1106574afd9db642        => "bm_b_d2806ba589f908da1106574afd9db642.ditamap",
                                              c_aaaa_121939eab89cd7d2c3eb4c4189772a1f      => "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita",
                                              c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b => "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita",
                                              c_aaaa_cccc_a91633094220d068c453eecae1726eff => "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita",
                                              c_aaaa_dddd_914b8e11993908497768c50d992ea0f0 => "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita",
                                              c_bbbb_6100b51ca1f789836cd4f31893ed67d2      => "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita",
                                              c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d => "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita",
                                              c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b => "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita",
                                              c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3 => "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita",
                                            },
    ltgt                                 => {},
    matchTopics                          => undef,
    maxZoomIn                            => undef,
    maxZoomOut                           => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => {},
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => {},
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => {},
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => {},
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => {},
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => {},
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => {},
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => {},
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => {},
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => {},
                                            },
    md5Sum                               => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => "80a6bceb08172a544d9eea67eed112b3",
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => "2169600694ec4e5378c524a93641a474",
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => "c67821ef3da2c89f0fc99fba3937f368",
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => "f0c0e170812810ef045d97602fdde76f",
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => "400c2c5995e17bf346473a135281bfaf",
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => "68822563d568f41838aef1c62cb4ac8d",
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => "96a20d7fbbafdeef55efe09a0a059251",
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => "86a684b01a0b4c306da924c74ff1f0cc",
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => "cfe7cb3d05e7a147db10dcbacaeecef7",
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => "2b6aab4f9328e326f55f160771a8c3dd",
                                            },
    md5SumDuplicates                     => {},
    missingImageFiles                    => {},
    missingTopicIds                      => {},
    noHref                               => {},
    notReferenced                        => {},
    olBody                               => {},
    originalSourceFileAndIdToNewFile     => {
                                              "a.xml" => {
                                                           "GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf" => "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita",
                                                           "GUID-68822563-d568-f418-38ae-f1c62cb4ac8d" => "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita",
                                                           "GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368" => "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita",
                                                           "GUID-f0c0e170-8128-10ef-045d-97602fdde76f" => "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita",
                                                         },
                                              "b.xml" => {
                                                           "GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd" => "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita",
                                                           "GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc" => "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita",
                                                           "GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251" => "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita",
                                                           "GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7" => "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita",
                                                           "p1" => "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita",
                                                           "p2" => "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita",
                                                           "p3" => "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita",
                                                         },
                                            },
    otherMeta                            => {},
    otherMetaBookMapsAfterTopicIncludes  => [],
    otherMetaBookMapsBeforeTopicIncludes => [],
    otherMetaConsolidated                => {},
    otherMetaDuplicatesCombined          => [],
    otherMetaDuplicatesSeparately        => [],
    otherMetaPushToBookMap               => [],
    otherMetaRemainWithTopic             => [],
    oxygenProjects                       => undef,
    parseFailed                          => {},
    publicId                             => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => "EN",
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => "EN",
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => "EN",
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => "EN",
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => "EN",
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => "EN",
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => "EN",
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => "EN",
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => "EN",
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => "EN",
                                            },
    references                           => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => {
                                                                                                       "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => 1,
                                                                                                       "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => 1,
                                                                                                       "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => 1,
                                                                                                       "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => 1,
                                                                                                     },
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => {
                                                                                                       "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => 1,
                                                                                                       "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => 1,
                                                                                                       "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => 1,
                                                                                                       "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => 1,
                                                                                                     },
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { p1 => 1 },
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { p2 => 1 },
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { p3 => 1 },
                                            },
    relocatedReferencesFailed            => [],
    relocatedReferencesFixed             => [],
    reports                              => \'\',
    requestAttributeNameAndValueCounts   => undef,
    requiredCleanUp                      => {},
    results                              => [[1, "ref"]],
    sourceTopicToTargetBookMap           => {
                                              "a.xml" => bless({
                                                           source => "a.xml",
                                                           sourceDocType => "concept",
                                                           target => "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap",
                                                           targetType => "bookmap",
                                                         }, "Bookmap"),
                                              "b.xml" => bless({
                                                           source => "b.xml",
                                                           sourceDocType => "concept",
                                                           target => "bm_b_d2806ba589f908da1106574afd9db642.ditamap",
                                                           targetType => "bookmap",
                                                         }, "Bookmap"),
                                            },
    statusLine                           => "Xref: 1 ref",
    statusTable                          => "   Count  Condition\\n1      1  ref\\n",
    subjectSchemeMap                     => undef,
    suppressReferenceChecks              => undef,
    tableDimensions                      => {},
    tagCount                             => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => {
                                                                                                       appendices        => 1,
                                                                                                       approved          => 1,
                                                                                                       author            => 1,
                                                                                                       bookchangehistory => 1,
                                                                                                       booklists         => 1,
                                                                                                       bookmap           => 1,
                                                                                                       bookmeta          => 1,
                                                                                                       bookowner         => 1,
                                                                                                       bookrights        => 1,
                                                                                                       booktitle         => 1,
                                                                                                       brand             => 1,
                                                                                                       category          => 1,
                                                                                                       CDATA             => 1,
                                                                                                       chapter           => 1,
                                                                                                       copyrfirst        => 1,
                                                                                                       frontmatter       => 1,
                                                                                                       keyword           => 1,
                                                                                                       keywords          => 1,
                                                                                                       mainbooktitle     => 1,
                                                                                                       notices           => 1,
                                                                                                       preface           => 1,
                                                                                                       prodinfo          => 1,
                                                                                                       prodname          => 1,
                                                                                                       prognum           => 1,
                                                                                                       relcell           => 4,
                                                                                                       relcolspec        => 2,
                                                                                                       relheader         => 1,
                                                                                                       relrow            => 2,
                                                                                                       reltable          => 1,
                                                                                                       revisionid        => 1,
                                                                                                       shortdesc         => 1,
                                                                                                       source            => 1,
                                                                                                       toc               => 1,
                                                                                                       topicref          => 3,
                                                                                                       vrm               => 1,
                                                                                                       vrmlist           => 1,
                                                                                                       year              => 1,
                                                                                                     },
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => {
                                                                                                       appendices        => 1,
                                                                                                       approved          => 1,
                                                                                                       author            => 1,
                                                                                                       bookchangehistory => 1,
                                                                                                       booklists         => 1,
                                                                                                       bookmap           => 1,
                                                                                                       bookmeta          => 1,
                                                                                                       bookowner         => 1,
                                                                                                       bookrights        => 1,
                                                                                                       booktitle         => 1,
                                                                                                       brand             => 1,
                                                                                                       category          => 1,
                                                                                                       CDATA             => 1,
                                                                                                       chapter           => 1,
                                                                                                       copyrfirst        => 1,
                                                                                                       frontmatter       => 1,
                                                                                                       keyword           => 1,
                                                                                                       keywords          => 1,
                                                                                                       mainbooktitle     => 1,
                                                                                                       notices           => 1,
                                                                                                       preface           => 1,
                                                                                                       prodinfo          => 1,
                                                                                                       prodname          => 1,
                                                                                                       prognum           => 1,
                                                                                                       relcell           => 4,
                                                                                                       relcolspec        => 2,
                                                                                                       relheader         => 1,
                                                                                                       relrow            => 2,
                                                                                                       reltable          => 1,
                                                                                                       revisionid        => 1,
                                                                                                       shortdesc         => 1,
                                                                                                       source            => 1,
                                                                                                       toc               => 1,
                                                                                                       topicref          => 3,
                                                                                                       vrm               => 1,
                                                                                                       vrmlist           => 1,
                                                                                                       year              => 1,
                                                                                                     },
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => { CDATA => 1, conbody => 1, concept => 1, title => 1 },
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { CDATA => 1, conbody => 1, concept => 1, p => 1, title => 1 },
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { CDATA => 1, conbody => 1, concept => 1, p => 1, title => 1 },
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { CDATA => 1, conbody => 1, concept => 1, p => 1, title => 1 },
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => { CDATA => 2, conbody => 1, concept => 1, p => 1, title => 1 },
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => { CDATA => 1, conbody => 1, concept => 1, title => 1 },
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => { CDATA => 2, conbody => 1, concept => 1, p => 1, title => 1 },
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => { CDATA => 2, conbody => 1, concept => 1, p => 1, title => 1 },
                                            },
    tags                                 => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => 43,
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => 43,
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => 3,
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => 4,
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => 4,
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => 4,
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => 4,
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => 3,
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => 4,
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => 4,
                                            },
    targetFolderContent                  => {
                                              "a.xml" => "bless({\\n  source => \\"a.xml\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap\\",\\n  targetType => \\"bookmap\\",\\n}, \\"SourceToTarget\\")",
                                              "b.xml" => "bless({\\n  source => \\"b.xml\\",\\n  sourceDocType => \\"concept\\",\\n  target => \\"bm_b_d2806ba589f908da1106574afd9db642.ditamap\\",\\n  targetType => \\"bookmap\\",\\n}, \\"SourceToTarget\\")",
                                            },
    targetTopicToInputFiles              => {
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => { "a.xml" => 1 },
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { "a.xml" => 1 },
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { "a.xml" => 1 },
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { "a.xml" => 1 },
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => { "b.xml" => 1 },
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => { "b.xml" => 1 },
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => { "b.xml" => 1 },
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => { "b.xml" => 1 },
                                            },
    texts                                => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => 1,
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => 1,
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => 1,
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => 1,
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => 1,
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => 1,
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => 2,
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => 1,
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => 2,
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => 2,
                                            },
    title                                => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => "a",
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => "b",
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => "aaaa",
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => "aaaa bbbb",
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => "aaaa cccc",
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => "aaaa dddd",
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => "bbbb",
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => "bbbb aaaa",
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => "bbbb bbbb",
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => "bbbb cccc",
                                            },
    titleToFile                          => {
                                              "aaaa"      => { "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita" => 1 },
                                              "aaaa bbbb" => { "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => 1 },
                                              "aaaa cccc" => { "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => 1 },
                                              "aaaa dddd" => { "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => 1 },
                                              "bbbb"      => { "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita" => 1 },
                                              "bbbb aaaa" => { "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => 1 },
                                              "bbbb bbbb" => { "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => 1 },
                                              "bbbb cccc" => { "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => 1 },
                                            },
    topicFlattening                      => {},
    topicFlatteningFactor                => 0,
    topicIds                             => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"     => "GUID-80a6bceb-0817-2a54-4d9e-ea67eed112b3",
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap"     => "GUID-21696006-94ec-4e53-78c5-24a93641a474",
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => "GUID-c67821ef-3da2-c89f-0fc9-9fba3937f368",
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => "GUID-f0c0e170-8128-10ef-045d-97602fdde76f",
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => "GUID-400c2c59-95e1-7bf3-4647-3a135281bfaf",
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => "GUID-68822563-d568-f418-38ae-f1c62cb4ac8d",
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => "GUID-96a20d7f-bbaf-deef-55ef-e09a0a059251",
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => "GUID-86a684b0-1a0b-4c30-6da9-24c74ff1f0cc",
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => "GUID-cfe7cb3d-05e7-a147-db10-dcbacaeecef7",
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => "GUID-2b6aab4f-9328-e326-f55f-160771a8c3dd",
                                            },
    topicsFlattened                      => 0,
    topicsNotReferencedFromBookMaps      => {},
    topicsReferencedFromBookMaps         => {
                                              "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap" => \'fix\',
                                              "bm_b_d2806ba589f908da1106574afd9db642.ditamap" => \'fix\',
                                            },
    topicsToReferringBookMaps            => {
                                              "c_aaaa_121939eab89cd7d2c3eb4c4189772a1f.dita"      => { "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap" => 1 },
                                              "c_aaaa_bbbb_55baefe9258538b26a95b0015a8d5a2b.dita" => { "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap" => 1 },
                                              "c_aaaa_cccc_a91633094220d068c453eecae1726eff.dita" => { "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap" => 1 },
                                              "c_aaaa_dddd_914b8e11993908497768c50d992ea0f0.dita" => { "bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap" => 1 },
                                              "c_bbbb_6100b51ca1f789836cd4f31893ed67d2.dita"      => { "bm_b_d2806ba589f908da1106574afd9db642.ditamap" => 1 },
                                              "c_bbbb_aaaa_cfd3a140e06a914fc8469583ad87829d.dita" => { "bm_b_d2806ba589f908da1106574afd9db642.ditamap" => 1 },
                                              "c_bbbb_bbbb_c90ebf976073b2a3f7a8dc27a3c8254b.dita" => { "bm_b_d2806ba589f908da1106574afd9db642.ditamap" => 1 },
                                              "c_bbbb_cccc_d1c80714275637cde524bdfa1304a8f3.dita" => { "bm_b_d2806ba589f908da1106574afd9db642.ditamap" => 1 },
                                            },
    urls                                 => {},
    urlsBad                              => {},
    urlsGood                             => {},
    validateUrls                         => undef,
    validationErrors                     => {},
    vocabulary                           => {},
    xrefBadFormat                        => {},
    xrefBadScope                         => {},
    xRefs                                => {},
    xrefsFixedByTitle                    => [],
  }, "Data::Edit::Xml::Xref");
  $a->{topicsReferencedFromBookMaps}{"bm_a_9d0a9f8e0ac234de9e22c19054b6e455.ditamap"} = $a->{inputFileToTargetTopics}{"a.xml"};
  $a->{topicsReferencedFromBookMaps}{"bm_b_d2806ba589f908da1106574afd9db642.ditamap"} = $a->{inputFileToTargetTopics}{"b.xml"};
  $a;
}};
 }

#latestTest:;
if (1) {                                                                        # Othermeta migration
lll "Test 018";
  clearFolder(tests, 111);
  createSampleOtherMeta(in);

  my $x = xref(inputFolder      => in,
               reports          => reportFolder,
               subjectSchemeMap => fpe(out, qw(subjectScheme map)));

  ok !$x->errors;

  is_deeply checkXrefStructure($x, q(otherMetaDuplicatesSeparately)), [];

  is_deeply checkXrefStructure($x, q(otherMetaDuplicatesCombined)),
   [["b1.ditamap", "dd", 2, "DD"], ["", "", "", "DD1111"],
    ["b2.ditamap", "dd", 2, "DD"], ["", "", "", "DD2222"]];

  is_deeply checkXrefStructure($x, q(otherMetaRemainWithTopic)),
   [[ "ca.dita", "dd", "DD", "b1.ditamap", "b2.ditamap"],
    [ "cb.dita", "dd", "DD", "b1.ditamap", "b2.ditamap"]];

  is_deeply checkXrefStructure($x, q(otherMetaPushToBookMap)),
   [[ "ca.dita", "aa", "AAAA", "b1.ditamap"],
    [ "ca.dita", "aa", "AAAA", "b2.ditamap"],
    [ "ca.dita", "bb", "BBBB", "b1.ditamap"],
    [ "ca.dita", "bb", "BBBB", "b2.ditamap"],
    [ "cb.dita", "aa", "AAAA", "b1.ditamap"],
    [ "cb.dita", "aa", "AAAA", "b2.ditamap"],
    [ "cb.dita", "bb", "BBBB", "b1.ditamap"],
    [ "cb.dita", "bb", "BBBB", "b2.ditamap"]];

  is_deeply checkXrefStructure($x, q(otherMetaBookMapsBeforeTopicIncludes)),
   [["b1.ditamap", "aa", 1, "AAAA"],
    ["b1.ditamap", "bb", 1, "BBBB"],
    ["b1.ditamap", "dd", 1, "DD1111"],
    ["b2.ditamap", "aa", 1, "AAAA"],
    ["b2.ditamap", "bb", 1, "BBBB"],
    ["b2.ditamap", "dd", 1, "DD2222"]];

  is_deeply checkXrefStructure($x, q(otherMetaBookMapsAfterTopicIncludes)),
   [["b1.ditamap", "aa", 1, "AAAA"],
    ["b1.ditamap", "bb", 1, "BBBB"],
    ["b1.ditamap", "dd", 2, "DD"],
    ["b1.ditamap", "dd", 2, "DD1111"],
    ["b2.ditamap", "aa", 1, "AAAA"],
    ["b2.ditamap", "bb", 1, "BBBB"],
    ["b2.ditamap", "dd", 2, "DD"],
    ["b2.ditamap", "dd", 2, "DD2222"]];
 }

#latestTest:;
if (1) {                                                                        # Othermeta migration
lll "Test 019";
  clearFolder(tests, 111);
  createTestOneNotRef(tests);

  my $x = xref(inputFolder => in, reports => reportFolder);

  ok !$x->errors;

  is_deeply checkXrefStructure($x, q(topicsNotReferencedFromBookMaps)),
            {"b.dita" => 1};
  is_deeply checkXrefStructure($x, q(topicsReferencedFromBookMaps)),
            {"a.ditamap" => {"a.dita" => 1}};
 }

#latestTest:;
if (1) {                                                                        # Classification and subject scheme maps
lll "Test 020";
  clearFolder(tests, 111);
  createClassificationMapsTest(in);

  my $x = xref
   (inputFolder        => in,
    reports            => reportFolder,
    classificationMaps => 1,
    subjectSchemeMap   => fpe(reportFolder, qw(subjectSchemeAndClassification ditamap)));

  ok !$x->errors;
  my $m1 = fpe(in, qw(maps m1_classification ditamap));
  my $m2 = fpe(in, qw(maps m2_classification ditamap));
  ok -e $_ for $m1, $m2;
  ok readFile($m1) =~ m\'<topicref href="m2_classification.ditamap">\'i;
 }

#latestTest:;
if (1) {                                                                        # Classification and subject scheme maps
lll "Test 021";
  clearFolder(tests, 111);
  createWordsToFilesTest(in);

  my $x = xref(inputFolder      => in,
               reports          => reportFolder,
               indexWords       => 1,
               indexWordsFolder => fpd(reportFolder, q(words)));
  ok  65 == $x->indexedWords;

  my $wt = fpe($x->indexWordsFolder, qw(words_to_topics data));
  my $tw = fpe($x->indexWordsFolder, qw(topics_to_words data));

  ok -e $wt;
  ok -e $tw;

  my $index = retrieve $wt;
  my $i     = intersectionOfHashesAsArrays(map {$index->{$_}} qw(make tea));

  is_deeply removeFilePathsFromStructure($i), { "tea.dita" => [2, 5] };
 }

#latestTest:;
if (1) {                                                                        # Classification and subject scheme maps
lll "Test 022";
  clearFolder(tests, 111);
  createSampleConRefs(&in);

  my $x = xref
   (inputFolder      => in,
    reports          => reportFolder,
    fixBadRefs       => 1,
    fixRelocatedRefs => 1,
    fixXrefsByTitle  => 1,
    fixedFolder      => outFixed,
   );

  is_deeply removeFilePathsFromStructure($x->ids),
   { "c1.dita" => { c1 => 2, i1 => 1, i2 => 2, x1 => 1 },
     "c2.dita" => { c2 => 2, p1 => 1, p2 => 1 },
   };

  is_deeply removeFilePathsFromStructure($x->references),
   { "c1.dita" => { "i1" => 1, "i2" => 1, "i3" => 3, "p1" => 1, "p2" => 1, "p3" => 1, },
   };

  is_deeply removeFilePathsFromStructure($x->idNotReferenced),
   { "c1.dita" => { c1 => 1, x1 => 1 },
     "c2.dita" => { c2 => 1 },
   };

  is_deeply removeFilePathsFromStructure($x->idReferencedCount),
   { "c1.dita" => { i1 => 1, i2 => 1, i3 => 3 },
     "c2.dita" => { p1 => 1, p2 => 1, p3 => 1 },
   };

  ok $x->statusLine eq q(Xref: 5 refs, 3 duplicate ids, 2 first lines, 2 second lines);

  my $fr = readFile(fpe(reportFolder, qw(bad failing_references txt)));
  ok index($fr, q(Comma_Separated_Values_of_column_Reference: "c1.dita#c1/i2","c1.dita#c1/i3","c2.dita#c2/p3")) > -1;
  ok index($fr, q(Comma_Separated_Values_of_column_Attr: "conref","href"))                                      > -1;

  my $di = readFile(fpe(reportFolder, qw(bad duplicateIds txt)));
  ok index($di, q(Comma_Separated_Values_of_column_Id: "c1","c2","i2")) > -1;
  ok index($di, q(Comma_Separated_Values_of_column_Count: 2))           > -1;
 }

#latestTest:;
if (1) {                                                                         # Classification and subject scheme maps
lll "Test 023";
  clearFolder(tests, 111);
  createEmptyBody(&in);

  my $x = xref(inputFolder => in, reports => reportFolder);

  ok !$x->errors;

  #say STDERR writeStructureTest($x->emptyTopics, q($x->emptyTopics));
  is_deeply removeFilePathsFromStructure($x->emptyTopics),
   {"c1.dita" => 1};
 }

#latestTest:;
if (1) {                                                                        # Topics to referring bookmaps
lll "Test 024";
  clearFolder(tests, 111);
  createSampleTopicsReferencedFromBookMaps(&in);

  my $x = xref(inputFolder => in, reports => reportFolder);

  ok $x->statusLine eq q(Xref: 6 refs, 5 first lines, 5 second lines, 3 image refs);

  is_deeply removeFilePathsFromStructure($x->topicsToReferringBookMaps),
   { "c1.dita" => { "m1.dita" => 1, "m2.dita" => 1, },
     "c2.dita" => { "m2.dita" => 1, },
   };

  is_deeply removeFilePathsFromStructure($x->topicsReferencedFromBookMaps),
   { "m1.dita" => { "c1.dita" => 1, },
     "m2.dita" => { "c1.dita" => 1, "c2.dita" => 1, },
   };

  is_deeply removeFilePathsFromStructure($x->imagesToRefferingBookMaps),
   { "1.png" => { "m1.dita" => 1, "m2.dita" => 2, },
     "2.png" => { "m2.dita" => 1, },
     };

  is_deeply removeFilePathsFromStructure($x->imagesReferencedFromBookMaps),
   { "m1.dita" => { "1.png" => 1, },
     "m2.dita" => { "1.png" => 2, "2.png" => 1, },
   };
 }

#latestTest:;
if (1) {                                                                        # Conref matching
lll "Test 025";
  clearFolder(tests, 111);
  createSampleConRefMatching(&in);

  my $x = xref(inputFolder => in, reports => reportFolder);
  ok $x->statusLine eq q(Xref: 2 first lines, 2 second lines);
 }

#latestTest:;
if (1) {                                                                        # Md5 sum duplicates
lll "Test 026";
  clearFolder(tests, 111);
  createSampleDuplicateMd5Sum(&in);

  my $x = xref(inputFolder => in, reports => reportFolder, html => reportFolder);
  ok $x->statusLine eq q(Xref: 5 duplicate files, 5 first lines, 5 missing topic ids, 5 second lines);

  #say STDERR writeStructureTest($x->md5SumDuplicates, q($x->md5SumDuplicates));
  is_deeply removeFilePathsFromStructure($x->md5SumDuplicates),
   { "3b6840b4a7409ae6b0f6daed9aa8f1db" => { "t.dita" => 1, "t.dita" => 1, },
     "a5899fda929f90ff7a2419fc61d5f8c3" => { "c.dita" => 1, "c.dita" => 1, "c.dita" => 1, },
   };
 }

#latestTest:;
if (1) {                                                                        # Remove unreferenced ids
lll "Test 027";
  clearFolder(tests, 111);
  createSampleUnreferencedIds(&in);

  my $x = xref(inputFolder => in, reports => reportFolder, deleteUnusedIds => 1);
  ok $x->statusLine eq q(Xref: 4 duplicate ids, 2 first lines, 2 second lines, 1 ref);
  is_deeply $x->idsRemoved, {c1=>1, c2=>1, p3=>1};

  ok readFile(fpe(&in, qw(c1 dita))) eq <<END;
<concept id="c1">
  <title/>
  <conbody>
    <p id="p1"/>
    <p id="p2"/>
    <p id="p2"/>
    <p/>
    <p/>
    <p/>
  </conbody>
</concept>
END

  ok readFile(fpe(&in, qw(c2 dita))) eq <<END;
<concept id="c2">
  <title/>
  <conbody>
    <p href="c1.dita#p1"/>
    <p conref="c1.dita#c1/p2"/>
  </conbody>
</concept>
END

  my $y = xref(inputFolder => in, reports => reportFolder, html=>reportFolder);
  ok $y->statusLine eq q(Xref: 2 first lines, 2 second lines, 1 duplicate id, 1 ref);

  #say STDERR writeStructureTest($y->duplicateIds, q($y->duplicateIds));
  is_deeply removeFilePathsFromStructure($y->duplicateIds),
   { "c1.dita" => { p2 => 2 },
   };

  ok readFile(fpe(reportFolder, qw(index_of_reports html))) =~ m(<b>31</b> reports available);
 }

#latestTest:;
if (1) {                                                                        # Remove unreferenced ids
lll "Test 028";
  clearFolder(tests, 111);
  createSampleImageReferences(&in);

  my $x = xref(inputFolder => in, reports => reportFolder);
  ok $x->statusLine eq q(Xref: 6 refs, 3 first lines, 3 second lines, 1 image ref);

  #say STDERR writeStructureTest($x->goodImageFiles, q($x->goodImageFiles));
  is_deeply removeFilePathsFromStructure($x->goodImageFiles),
   { "good1.png" => 3, "good2.png" => 3};

  #say STDERR writeStructureTest($x->missingImageFiles, q($x->missingImageFiles));
  is_deeply removeFilePathsFromStructure($x->missingImageFiles),
   { "bad1.png" => 6, };
 }

#latestTest:;
if (1) {                                                                        # Required clean ups report
lll "Test 029";
  clearFolder(tests, 111);
  createRequiredCleanUps(&in);

  my $x = xref(inputFolder => in, reports => reportFolder);
  ok $x->statusLine eq q(Xref: 2 first lines, 2 second lines);

  #dumpFile(q(/home/phil/z/xref.data), deleteVariableFields($x)); exit;
  is_deeply deleteVariableFields($x),
 {addNavTitles                         => undef,
  allowUniquePartialMatches            => undef,
  attributeCount                       => { "c1.dita" => { id => 1 }, "c2.dita" => { id => 1 } },
  attributeNamesAndValuesCount         => {
                                            "c1.dita" => { id => { c1 => 1 } },
                                            "c2.dita" => { id => { c2 => 1 } },
                                          },
  author                               => {},
  badGuidHrefs                         => {},
  badNavTitles                         => {},
  badReferencesCount                   => 0,
  badTables                            => [],
  badXml1                              => { "c1.dita" => 1, "c2.dita" => 1 },
  badXml2                              => { "c1.dita" => 1, "c2.dita" => 1 },
  baseFiles                            => {},
  baseTag                              => { "c1.dita" => "concept", "c2.dita" => "concept" },
  bookMapRefs                          => {},
  changeBadXrefToPh                    => undef,
  classificationMaps                   => undef,
  conRefs                              => {},
  createReports1                       => [
                                            "reportXml1",
                                            "reportXml2",
                                            "reportDuplicateIds",
                                            "reportDuplicateTopicIds",
                                            "reportNoHrefs",
                                            "reportTables",
                                            "reportParseFailed",
                                            "reportAttributeCount",
                                            "reportLtGt",
                                            "reportTagCount",
                                            "reportTagsAndTextsCount",
                                            "reportDocTypeCount",
                                            "reportFileExtensionCount",
                                            "reportFileTypes",
                                            "reportValidationErrors",
                                            "reportGuidHrefs",
                                            "reportExternalXrefs",
                                            "reportTopicDetails",
                                            "reportTopicReuse",
                                            "reportMd5Sum",
                                            "reportOlBody",
                                            "reportHrefUrlEncoding",
                                            "reportFixRefs",
                                            "reportSourceFiles",
                                            "reportOtherMeta",
                                            "createSubjectSchemeMap",
                                            "reportTopicsNotReferencedFromBookMaps",
                                            "reportTableDimensions",
                                            "reportExteriorMaps",
                                            "createClassificationMaps",
                                            "reportIdRefs",
                                            "reportEmptyTopics",
                                            "reportConRefMatching",
                                            "reportPublicIds",
                                            "reportRequiredCleanUps",
                                          ],
  createReports2                       => ["removeUnusedIds", "reportImages"],
  currentFolder                        => "",
  deguidize                            => undef,
  deleteUnusedIds                      => 0,
  docType                              => { "c1.dita" => "concept", "c2.dita" => "concept" },
  duplicateIds                         => {},
  duplicateTopicIds                    => {},
  emptyTopics                          => {},
  errors                               => 2,
  exteriorMaps                         => {},
  fileExtensions                       => [".dita", ".ditamap", ".xml", ".fodt"],
  fixBadRefs                           => undef,
  fixDitaRefs                          => undef,
  fixedFolder                          => undef,
  fixedFolderTemp                      => "",
  fixedRefsBad                         => [],
  fixedRefsGB                          => [],
  fixedRefsGood                        => [],
  fixedRefsNoAction                    => [],
  fixRefs                              => {},
  fixRelocatedRefs                     => undef,
  fixXrefsByTitle                      => undef,
  flattenFiles                         => {},
  flattenFolder                        => undef,
  getFileUrl                           => "client.pl?getFile=",
  goodImageFiles                       => {},
  goodNavTitles                        => {},
  guidHrefs                            => {},
  guidToFile                           => {},
  hrefUrlEncoding                      => {},
  html                                 => undef,
  idNotReferenced                      => { "c1.dita" => { c1 => 1 }, "c2.dita" => { c2 => 1 } },
  idReferencedCount                    => {},
  ids                                  => { "c1.dita" => { c1 => 1 }, "c2.dita" => { c2 => 1 } },
  idsRemoved                           => { c1 => 1, c2 => 1 },
  idTags                               => {
                                            "c1.dita" => { c1 => ["concept"] },
                                            "c2.dita" => { c2 => ["concept"] },
                                          },
  images                               => {},
  imagesReferencedFromBookMaps         => {},
  imagesReferencedFromTopics           => {},
  imagesToRefferingBookMaps            => {},
  indexedWords                         => {},
  indexWords                           => undef,
  indexWordsFolder                     => undef,
  inputFiles                           => ["c1.dita", "c2.dita"],
  inputFileToTargetTopics              => {},
  inputFolder                          => "",
  inputFolderImages                    => { c1 => "c1.dita", c2 => "c2.dita" },
  ltgt                                 => {},
  matchTopics                          => undef,
  maxZoomIn                            => undef,
  maxZoomOut                           => { "c1.dita" => {}, "c2.dita" => {} },
  md5Sum                               => {
                                            "c1.dita" => "92ab49a6d97f749545ec5dc873f53bdb",
                                            "c2.dita" => "a3df8bdda952294d6a533b7ff4f6faeb",
                                          },
  md5SumDuplicates                     => {},
  missingImageFiles                    => {},
  missingTopicIds                      => {},
  noHref                               => {},
  notReferenced                        => {},
  olBody                               => {},
  originalSourceFileAndIdToNewFile     => {},
  otherMeta                            => {},
  otherMetaBookMapsAfterTopicIncludes  => [],
  otherMetaBookMapsBeforeTopicIncludes => [],
  otherMetaConsolidated                => {},
  otherMetaDuplicatesCombined          => [],
  otherMetaDuplicatesSeparately        => [],
  otherMetaPushToBookMap               => [],
  otherMetaRemainWithTopic             => [],
  oxygenProjects                       => undef,
  parseFailed                          => {},
  publicId                             => { "c1.dita" => undef, "c2.dita" => undef },
  references                           => {},
  relocatedReferencesFailed            => [],
  relocatedReferencesFixed             => [],
  reports                              => \'\',
  requestAttributeNameAndValueCounts   => undef,
  requiredCleanUp                      => {
                                            "c1.dita" => { aaa => 1, bbb => 2 },
                                            "c2.dita" => { aaa => 1, bbb => 1, ccc => 1, CCC => 1 },
                                          },
  results                              => [[2, "first lines"], [2, "second lines"]],
  sourceTopicToTargetBookMap           => {},
  statusLine                           => "Xref: 2 first lines, 2 second lines",
  statusTable                          => "   Count  Condition\\n1      2  first lines\\n2      2  second lines\\n",
  subjectSchemeMap                     => undef,
  suppressReferenceChecks              => undef,
  tableDimensions                      => {},
  tagCount                             => {
                                            "c1.dita" => {
                                                           "CDATA" => 4,
                                                           "conbody" => 1,
                                                           "concept" => 1,
                                                           "required-cleanup" => 3,
                                                           "title" => 1,
                                                         },
                                            "c2.dita" => {
                                                           "CDATA" => 5,
                                                           "conbody" => 1,
                                                           "concept" => 1,
                                                           "required-cleanup" => 4,
                                                           "title" => 1,
                                                         },
                                          },
  tags                                 => { "c1.dita" => 6, "c2.dita" => 7 },
  targetFolderContent                  => {},
  targetTopicToInputFiles              => {},
  texts                                => { "c1.dita" => 4, "c2.dita" => 5 },
  title                                => { "c1.dita" => "C1_", "c2.dita" => "C2_" },
  titleToFile                          => { C1_ => { "c1.dita" => 1 }, C2_ => { "c2.dita" => 1 } },
  topicFlattening                      => {},
  topicFlatteningFactor                => {},
  topicIds                             => { "c1.dita" => "c1", "c2.dita" => "c2" },
  topicsFlattened                      => undef,
  topicsNotReferencedFromBookMaps      => { "c1.dita" => 1, "c2.dita" => 1 },
  topicsReferencedFromBookMaps         => {},
  topicsToReferringBookMaps            => {},
  urls                                 => {},
  urlsBad                              => {},
  urlsGood                             => {},
  validateUrls                         => undef,
  validationErrors                     => {},
  vocabulary                           => {},
  xrefBadFormat                        => {},
  xrefBadScope                         => {},
  xRefs                                => {},
  xrefsFixedByTitle                    => [],
};

  #say STDERR writeStructureTest($x->requiredCleanUp, q($x->requiredCleanUp));
  is_deeply removeFilePathsFromStructure($x->requiredCleanUp),
   { "c1.dita" => { aaa => 1, bbb => 2 },
     "c2.dita" => { aaa => 1, bbb => 1, ccc => 1, CCC => 1 },
   };
 }

#latestTest:;
if (1) {                                                                        # Soft conrefs
lll "Test 030";
  clearFolder(tests, 111);
  createSoftConrefs(&in);

  my $x = xref(inputFolder      => in, reports => reportFolder);
  ok $x->statusLine eq q(Xref: 7 refs, 1 duplicate id, 1 duplicate topic id);

  my $y = xref
   (inputFolder      => in,
    reports          => reportFolder,
    fixRelocatedRefs => 1,
    fixedFolder      => outFixed,
   );

  ok $y->statusLine eq q(Xref: 7 refs, 1 duplicate id, 1 duplicate topic id);

  my $z = xref(inputFolder => outFixed, reports => reportFolder);
  ok $z->statusLine eq q(Xref: 6 refs, 1 duplicate id, 1 duplicate topic id);

  #dumpFile(q(/home/phil/z/xref.data), deleteVariableFields($z)); exit;
  is_deeply deleteVariableFields($z),
 {addNavTitles                         => undef,
  allowUniquePartialMatches            => undef,
  attributeCount                       => {
                                            "c.dita" => { conref => 6, id => 2 },
                                            "c_12345678123456781234567812345678.dita" => { conref => 2, id => 3 },
                                          },
  attributeNamesAndValuesCount         => {
                                            "c.dita" => {
                                              conref => {
                                                "bad" => 1,
                                                "c.dta" => 1,
                                                "c_12345678123456781234567812345678.dita" => 1,
                                                "p1" => 1,
                                                "q1" => 1,
                                              },
                                              id => { c => 1, q1 => 1 },
                                            },
                                            "c_12345678123456781234567812345678.dita" => { conref => { p1 => 1, pp => 1 }, id => { c => 1, p1 => 2 } },
                                          },
  author                               => {},
  badGuidHrefs                         => {},
  badNavTitles                         => {},
  badReferencesCount                   => 6,
  badTables                            => [],
  badXml1                              => {},
  badXml2                              => {},
  baseFiles                            => {},
  baseTag                              => {
                                            "c.dita" => "concept",
                                            "c_12345678123456781234567812345678.dita" => "concept",
                                          },
  bookMapRefs                          => {},
  changeBadXrefToPh                    => undef,
  classificationMaps                   => undef,
  conRefs                              => {
                                            "c.dita" => {
                                              "bad" => { p => 1 },
                                              "c.dta" => { p => 1 },
                                              "c_12345678123456781234567812345678.dita" => { p => 1 },
                                              "p1" => { p => 1 },
                                              "q1" => { p => 1 },
                                            },
                                            "c_12345678123456781234567812345678.dita" => { p1 => { p => 1 }, pp => { p => 1 } },
                                          },
  createReports1                       => [
                                            "reportXml1",
                                            "reportXml2",
                                            "reportDuplicateIds",
                                            "reportDuplicateTopicIds",
                                            "reportNoHrefs",
                                            "reportTables",
                                            "reportParseFailed",
                                            "reportAttributeCount",
                                            "reportLtGt",
                                            "reportTagCount",
                                            "reportTagsAndTextsCount",
                                            "reportDocTypeCount",
                                            "reportFileExtensionCount",
                                            "reportFileTypes",
                                            "reportValidationErrors",
                                            "reportGuidHrefs",
                                            "reportExternalXrefs",
                                            "reportTopicDetails",
                                            "reportTopicReuse",
                                            "reportMd5Sum",
                                            "reportOlBody",
                                            "reportHrefUrlEncoding",
                                            "reportFixRefs",
                                            "reportSourceFiles",
                                            "reportOtherMeta",
                                            "createSubjectSchemeMap",
                                            "reportTopicsNotReferencedFromBookMaps",
                                            "reportTableDimensions",
                                            "reportExteriorMaps",
                                            "createClassificationMaps",
                                            "reportIdRefs",
                                            "reportEmptyTopics",
                                            "reportConRefMatching",
                                            "reportPublicIds",
                                            "reportRequiredCleanUps",
                                          ],
  createReports2                       => ["removeUnusedIds", "reportImages"],
  currentFolder                        => "",
  deguidize                            => undef,
  deleteUnusedIds                      => 0,
  docType                              => {
                                            "c.dita" => "concept",
                                            "c_12345678123456781234567812345678.dita" => "concept",
                                          },
  duplicateIds                         => { "c_12345678123456781234567812345678.dita" => { p1 => 2 } },
  duplicateTopicIds                    => { c => ["c", "c_12345678123456781234567812345678.dita", "c.dita"] },
  emptyTopics                          => {},
  errors                               => 3,
  exteriorMaps                         => {},
  fileExtensions                       => [".dita", ".ditamap", ".xml", ".fodt"],
  fixBadRefs                           => undef,
  fixDitaRefs                          => undef,
  fixedFolder                          => undef,
  fixedFolderTemp                      => "",
  fixedRefsBad                         => [
                                            [
                                              "Not fixable",
                                              "p",
                                              "conref",
                                              "p1",
                                              "c_12345678123456781234567812345678.dita",
                                            ],
                                            [
                                              "Not fixable",
                                              "p",
                                              "conref",
                                              "pp",
                                              "c_12345678123456781234567812345678.dita",
                                            ],
                                            ["Not fixable", "p", "conref", "c.dta", "c.dita"],
                                            ["Not fixable", "p", "conref", "bad", "c.dita"],
                                            ["Not fixable", "p", "conref", "p1", "c.dita"],
                                            ["Not fixable", "p", "conref", "p1", "c.dita"],
                                          ],
  fixedRefsGB                          => [],
  fixedRefsGood                        => [],
  fixedRefsNoAction                    => [],
  fixRefs                              => {
                                            "c.dita" => { "bad" => 1, "c.dta" => 1, "p1" => 1 },
                                            "c_12345678123456781234567812345678.dita" => { p1 => 1, pp => 1 },
                                          },
  fixRelocatedRefs                     => undef,
  fixXrefsByTitle                      => undef,
  flattenFiles                         => {},
  flattenFolder                        => undef,
  getFileUrl                           => "client.pl?getFile=",
  goodImageFiles                       => {},
  goodNavTitles                        => {},
  guidHrefs                            => {},
  guidToFile                           => {},
  hrefUrlEncoding                      => {},
  html                                 => undef,
  idNotReferenced                      => {
                                            "c.dita" => { c => 1 },
                                            "c_12345678123456781234567812345678.dita" => { c => 1 },
                                          },
  idReferencedCount                    => {
                                            "c.dita" => { q1 => 1 },
                                            "c_12345678123456781234567812345678.dita" => { bad => 1, p1 => 3, pp => 1 },
                                          },
  ids                                  => {
                                            "c.dita" => { c => 1, q1 => 1 },
                                            "c_12345678123456781234567812345678.dita" => { c => 1, p1 => 2 },
                                          },
  idsRemoved                           => { c => 2 },
  idTags                               => {
                                            "c.dita" => { c => ["concept"], q1 => ["p"] },
                                            "c_12345678123456781234567812345678.dita" => { c => ["concept"], p1 => ["p", "p"] },
                                          },
  images                               => {},
  imagesReferencedFromBookMaps         => {},
  imagesReferencedFromTopics           => {},
  imagesToRefferingBookMaps            => {},
  indexedWords                         => {},
  indexWords                           => undef,
  indexWordsFolder                     => undef,
  inputFiles                           => ["c.dita", "c_12345678123456781234567812345678.dita"],
  inputFileToTargetTopics              => {},
  inputFolder                          => "",
  inputFolderImages                    => {
                                            c => "c.dita",
                                            c_12345678123456781234567812345678 => "c_12345678123456781234567812345678.dita",
                                          },
  ltgt                                 => {},
  matchTopics                          => undef,
  maxZoomIn                            => undef,
  maxZoomOut                           => { "c.dita" => {}, "c_12345678123456781234567812345678.dita" => {} },
  md5Sum                               => {
                                            "c.dita" => "c7c95918b94057943d448ca99e5424cc",
                                            "c_12345678123456781234567812345678.dita" => "d3d1c1ce281895768bd92f27fd492191",
                                          },
  md5SumDuplicates                     => {},
  missingImageFiles                    => {},
  missingTopicIds                      => {},
  noHref                               => {},
  notReferenced                        => {},
  olBody                               => {},
  originalSourceFileAndIdToNewFile     => {},
  otherMeta                            => {},
  otherMetaBookMapsAfterTopicIncludes  => [],
  otherMetaBookMapsBeforeTopicIncludes => [],
  otherMetaConsolidated                => {},
  otherMetaDuplicatesCombined          => [],
  otherMetaDuplicatesSeparately        => [],
  otherMetaPushToBookMap               => [],
  otherMetaRemainWithTopic             => [],
  oxygenProjects                       => undef,
  parseFailed                          => {},
  publicId                             => { "c.dita" => "EN", "c_12345678123456781234567812345678.dita" => "EN" },
  references                           => {
                                            "c.dita" => {
                                              "bad" => 1,
                                              "c.dta" => 1,
                                              "c_12345678123456781234567812345678.dita" => 1,
                                              "p1" => 1,
                                              "q1" => 1,
                                            },
                                            "c_12345678123456781234567812345678.dita" => { p1 => 1, pp => 1 },
                                          },
  relocatedReferencesFailed            => [],
  relocatedReferencesFixed             => [],
  reports                              => \'\',
  requestAttributeNameAndValueCounts   => undef,
  requiredCleanUp                      => {},
  results                              => [[1, "duplicate id"], [6, "refs"], [1, "duplicate topic id"]],
  sourceTopicToTargetBookMap           => {},
  statusLine                           => "Xref: 6 refs, 1 duplicate id, 1 duplicate topic id",
  statusTable                          => "   Count  Condition\\n1      6  refs\\n2      1  duplicate id\\n3      1  duplicate topic id\\n",
  subjectSchemeMap                     => undef,
  suppressReferenceChecks              => undef,
  tableDimensions                      => {},
  tagCount                             => {
                                            "c.dita" => { CDATA => 2, conbody => 1, concept => 1, p => 7, title => 1 },
                                            "c_12345678123456781234567812345678.dita" => { CDATA => 3, conbody => 1, concept => 1, p => 4, title => 1 },
                                          },
  tags                                 => { "c.dita" => 10, "c_12345678123456781234567812345678.dita" => 7 },
  targetFolderContent                  => {},
  targetTopicToInputFiles              => {},
  texts                                => { "c.dita" => 2, "c_12345678123456781234567812345678.dita" => 3 },
  title                                => { "c.dita" => "C2", "c_12345678123456781234567812345678.dita" => "C1" },
  titleToFile                          => {
                                            C1 => { "c_12345678123456781234567812345678.dita" => 1 },
                                            C2 => { "c.dita" => 1 },
                                          },
  topicFlattening                      => {},
  topicFlatteningFactor                => {},
  topicIds                             => { "c.dita" => "c", "c_12345678123456781234567812345678.dita" => "c" },
  topicsFlattened                      => undef,
  topicsNotReferencedFromBookMaps      => { "c.dita" => 1, "c_12345678123456781234567812345678.dita" => 1 },
  topicsReferencedFromBookMaps         => {},
  topicsToReferringBookMaps            => {},
  urls                                 => {},
  urlsBad                              => {},
  urlsGood                             => {},
  validateUrls                         => undef,
  validationErrors                     => {},
  vocabulary                           => {},
  xrefBadFormat                        => {},
  xrefBadScope                         => {},
  xRefs                                => {},
  xrefsFixedByTitle                    => [],
};
 }

#latestTest:;
if (1) {                                                                        # Oxygen project files
lll "Test 031";
  clearFolder(tests, 111);
  createSampleInputFilesBaseCase(&in, 8);

  my $x = xref(inputFolder => in, reports => reportFolder, oxygenProjects=>1);
  ok $x->statusLine eq q(Xref: 104 refs, 21 image refs, 14 first lines, 14 second lines, 8 duplicate ids, 4 duplicate topic ids, 4 invalid guid hrefs, 2 duplicate files, 2 tables, 1 External xrefs with no format=html, 1 External xrefs with no scope=external, 1 file failed to parse, 1 href missing);
 }

#latestTest:;
if (0) {                                                                        # Performance tests 1.419
lll "Test 032";
  my $folder = q(/home/phil/perl/cpan/DataEditXmlXref/lib/Data/Edit/Xml/samples/);
  xref(inputFolder => $folder);
 }

#latestTest:;
if (1) {                                                                        # Urls
lll "Test 033 Urls";
  clearFolder(tests, 222);
  createUrlTests(&in);

  my $x = xref(inputFolder => in, reports => reportFolder, validateUrls=>1);

  ok $x->statusLine eq q(Xref: 2 urls);

#  dumpFile(q(/home/phil/z/xref.data), deleteVariableFields($x));
  is_deeply deleteVariableFields($x),
bless({
  addNavTitles                         => undef,
  allowUniquePartialMatches            => undef,
  attributeCount                       => {
                                            "concept.dita" => { format => 2, href => 2, id => 1, scope => 2 },
                                          },
  attributeNamesAndValuesCount         => {
                                            "concept.dita" => {
                                              format => { html => 2 },
                                              href => { "ww2.appaapps.com" => 1, "www.appaapps.com" => 1 },
                                              id => { c => 1 },
                                              scope => { external => 2 },
                                            },
                                          },
  author                               => {},
  badGuidHrefs                         => {},
  badNavTitles                         => {},
  badReferencesCount                   => 0,
  badTables                            => [],
  badXml1                              => {},
  badXml2                              => {},
  baseFiles                            => {},
  baseTag                              => { "concept.dita" => "concept" },
  bookMapRefs                          => {},
  changeBadXrefToPh                    => undef,
  classificationMaps                   => undef,
  conRefs                              => {},
  createReports1                       => [
                                            "reportXml1",
                                            "reportXml2",
                                            "reportDuplicateIds",
                                            "reportDuplicateTopicIds",
                                            "reportNoHrefs",
                                            "reportTables",
                                            "reportParseFailed",
                                            "reportAttributeCount",
                                            "reportLtGt",
                                            "reportTagCount",
                                            "reportTagsAndTextsCount",
                                            "reportDocTypeCount",
                                            "reportFileExtensionCount",
                                            "reportFileTypes",
                                            "reportValidationErrors",
                                            "reportGuidHrefs",
                                            "reportExternalXrefs",
                                            "reportTopicDetails",
                                            "reportTopicReuse",
                                            "reportMd5Sum",
                                            "reportOlBody",
                                            "reportHrefUrlEncoding",
                                            "reportFixRefs",
                                            "reportSourceFiles",
                                            "reportOtherMeta",
                                            "createSubjectSchemeMap",
                                            "reportTopicsNotReferencedFromBookMaps",
                                            "reportTableDimensions",
                                            "reportExteriorMaps",
                                            "createClassificationMaps",
                                            "reportIdRefs",
                                            "reportEmptyTopics",
                                            "reportConRefMatching",
                                            "reportPublicIds",
                                            "reportRequiredCleanUps",
                                            "reportUrls",
                                          ],
  createReports2                       => ["removeUnusedIds", "reportImages"],
  currentFolder                        => "",
  deguidize                            => undef,
  deleteUnusedIds                      => 0,
  docType                              => { "concept.dita" => "concept" },
  duplicateIds                         => {},
  duplicateTopicIds                    => {},
  emptyTopics                          => {},
  errors                               => 1,
  exteriorMaps                         => {},
  fileExtensions                       => [".dita", ".ditamap", ".xml", ".fodt"],
  fixBadRefs                           => undef,
  fixDitaRefs                          => undef,
  fixedFolder                          => undef,
  fixedFolderTemp                      => "",
  fixedRefsBad                         => [],
  fixedRefsGB                          => [],
  fixedRefsGood                        => [],
  fixedRefsNoAction                    => [],
  fixRefs                              => {},
  fixRelocatedRefs                     => undef,
  fixXrefsByTitle                      => undef,
  flattenFiles                         => {},
  flattenFolder                        => undef,
  getFileUrl                           => "client.pl?getFile=",
  goodImageFiles                       => {},
  goodNavTitles                        => {},
  guidHrefs                            => {},
  guidToFile                           => {},
  hrefUrlEncoding                      => {},
  html                                 => undef,
  idNotReferenced                      => { "concept.dita" => { c => 1 } },
  idReferencedCount                    => {},
  ids                                  => { "concept.dita" => { c => 1 } },
  idsRemoved                           => { c => 1 },
  idTags                               => { "concept.dita" => { c => ["concept"] } },
  images                               => {},
  imagesReferencedFromBookMaps         => {},
  imagesReferencedFromTopics           => {},
  imagesToRefferingBookMaps            => {},
  indexedWords                         => {},
  indexWords                           => undef,
  indexWordsFolder                     => undef,
  inputFiles                           => ["concept.dita"],
  inputFileToTargetTopics              => {},
  inputFolder                          => "",
  inputFolderImages                    => { concept => "concept.dita" },
  ltgt                                 => {},
  matchTopics                          => undef,
  maxZoomIn                            => undef,
  maxZoomOut                           => { "concept.dita" => {} },
  md5Sum                               => { "concept.dita" => "f38f3212622c0fd073b213176a045e47" },
  md5SumDuplicates                     => {},
  missingImageFiles                    => {},
  missingTopicIds                      => {},
  noHref                               => {},
  notReferenced                        => {},
  olBody                               => {},
  originalSourceFileAndIdToNewFile     => {},
  otherMeta                            => {},
  otherMetaBookMapsAfterTopicIncludes  => [],
  otherMetaBookMapsBeforeTopicIncludes => [],
  otherMetaConsolidated                => {},
  otherMetaDuplicatesCombined          => [],
  otherMetaDuplicatesSeparately        => [],
  otherMetaPushToBookMap               => [],
  otherMetaRemainWithTopic             => [],
  oxygenProjects                       => undef,
  parseFailed                          => {},
  publicId                             => { "concept.dita" => "EN" },
  references                           => {},
  relocatedReferencesFailed            => [],
  relocatedReferencesFixed             => [],
  reports                              => "",
  requestAttributeNameAndValueCounts   => undef,
  requiredCleanUp                      => {},
  results                              => [[2, "urls"]],
  sourceTopicToTargetBookMap           => {},
  statusLine                           => "Xref: 2 urls",
  statusTable                          => "   Count  Condition\\n1      2  urls\\n",
  subjectSchemeMap                     => undef,
  suppressReferenceChecks              => undef,
  tableDimensions                      => {},
  tagCount                             => {
                                            "concept.dita" => { CDATA => 3, conbody => 1, concept => 1, p => 2, title => 1, xref => 2 },
                                          },
  tags                                 => { "concept.dita" => 7 },
  targetFolderContent                  => {},
  targetTopicToInputFiles              => {},
  texts                                => { "concept.dita" => 3 },
  title                                => { "concept.dita" => "Urls" },
  titleToFile                          => { Urls => { "concept.dita" => 1 } },
  topicFlattening                      => {},
  topicFlatteningFactor                => {},
  topicIds                             => { "concept.dita" => "c" },
  topicsFlattened                      => undef,
  topicsNotReferencedFromBookMaps      => { "concept.dita" => 1 },
  topicsReferencedFromBookMaps         => {},
  topicsToReferringBookMaps            => {},
  urls                                 => {
                                            "concept.dita" => { "ww2.appaapps.com" => 1, "www.appaapps.com" => 1 },
                                          },
  urlsBad                              => {
                                            "ww2.appaapps.com" => { "concept.dita" => 1 },
                                            "www.appaapps.com" => { "concept.dita" => 1 },
                                          },
  urlsGood                             => {},
  validateUrls                         => 1,
  validationErrors                     => {},
  vocabulary                           => {},
  xrefBadFormat                        => {},
  xrefBadScope                         => {},
  xRefs                                => {},
  xrefsFixedByTitle                    => [],
}, "Data::Edit::Xml::Xref")
 }

clearFolder($_, 1e3) for in, out, outFixed, reportFolder, tests, targets, q(zzzParseErrors);

done_testing;

lll "Tests finished:";  # 16.212
' called at lib/Data/Edit/Xml/Xref.pm line 6043
	Data::Edit::Xml::Xref::test() called at test.pl line 10
 at /tmp/loop_over_bdir-31753-iDm7aS/Data-Table-Text-20200418-0/blib/lib/Data/Table/Text.pm line 4095.
	Data::Table::Text::__ANON__("Failed to write to file:\x{a}/tmp/iGnrehoRXQ/report/timing/xref_p"...) called at lib/Data/Edit/Xml/Xref.pm line 6044
	Data::Edit::Xml::Xref::test() called at test.pl line 10
01:06:19 Xref: 1 ref                                                             at lib/Data/Edit/Xml/Xref.pm line 400
01:06:20 Xref: processed 2 files, found no errors                                at lib/Data/Edit/Xml/Xref.pm line 400
01:06:20 Test 011                                                                at (eval 113) line 1458
01:06:22 Xref: 1 ref                                                             at lib/Data/Edit/Xml/Xref.pm line 400
01:06:23 Xref: processed 4 files, found no errors                                at lib/Data/Edit/Xml/Xref.pm line 400
01:06:24 Test 012                                                                at (eval 113) line 1476
01:06:25 Xref: 1 ref                                                             at lib/Data/Edit/Xml/Xref.pm line 400
01:06:27 Xref: processed 2 files, found no errors                                at lib/Data/Edit/Xml/Xref.pm line 400
01:06:27 Test 013                                                                at (eval 113) line 1496
01:06:28 Xref: 1 image ref, 1 ref                                                at lib/Data/Edit/Xml/Xref.pm line 400
01:06:28 Test 014                                                                at (eval 113) line 1514
01:06:30 Xref: processed 1 files, found no errors                                at lib/Data/Edit/Xml/Xref.pm line 400
01:06:30 Test 016                                                                at (eval 113) line 1536
01:06:31 Xref: 1 ref                                                             at lib/Data/Edit/Xml/Xref.pm line 400
01:06:33 Xref: processed 2 files, found no errors                                at lib/Data/Edit/Xml/Xref.pm line 400
01:06:33 Test 017                                                                at (eval 113) line 1569
01:06:35 Xref: 1 ref                                                             at lib/Data/Edit/Xml/Xref.pm line 400
01:06:35 Test 018                                                                at (eval 113) line 2240
01:06:36 Xref: processed 4 files, found no errors                                at lib/Data/Edit/Xml/Xref.pm line 400
01:06:36 Test 019                                                                at (eval 113) line 2291
01:06:38 Xref: processed 3 files, found no errors                                at lib/Data/Edit/Xml/Xref.pm line 400
01:06:38 Test 020                                                                at (eval 113) line 2307
01:06:39 Xref: processed 4 files, found no errors                                at lib/Data/Edit/Xml/Xref.pm line 400
01:06:39 Test 021                                                                at (eval 113) line 2326
01:06:41 Xref: 2 first lines, 2 second lines                                     at lib/Data/Edit/Xml/Xref.pm line 400
01:06:41 Test 022                                                                at (eval 113) line 2350
01:06:42 Xref: 5 refs, 3 duplicate ids, 2 first lines, 2 second lines            at lib/Data/Edit/Xml/Xref.pm line 400
01:06:43 Test 023                                                                at (eval 113) line 2395
01:06:44 Xref: processed 2 files, found no errors                                at lib/Data/Edit/Xml/Xref.pm line 400
01:06:44 Test 024                                                                at (eval 113) line 2410
01:06:46 Xref: 6 refs, 5 first lines, 5 second lines, 3 image refs               at lib/Data/Edit/Xml/Xref.pm line 400
01:06:46 Test 025                                                                at (eval 113) line 2441
01:06:47 Xref: 2 first lines, 2 second lines                                     at lib/Data/Edit/Xml/Xref.pm line 400
01:06:47 Test 026                                                                at (eval 113) line 2451
01:06:49 Xref: 5 duplicate files, 5 first lines, 5 missing topic ids, 5 second lines                                                                             at lib/Data/Edit/Xml/Xref.pm line 400
01:06:49 Test 027                                                                at (eval 113) line 2467
01:06:51 Xref: 4 duplicate ids, 2 first lines, 2 second lines, 1 ref             at lib/Data/Edit/Xml/Xref.pm line 400
01:06:53 Xref: 2 first lines, 2 second lines, 1 duplicate id, 1 ref              at lib/Data/Edit/Xml/Xref.pm line 400
01:06:53 Test 028                                                                at (eval 113) line 2512
01:06:55 Xref: 6 refs, 3 first lines, 3 second lines, 1 image ref                at lib/Data/Edit/Xml/Xref.pm line 400
01:06:55 Test 029                                                                at (eval 113) line 2530
01:06:56 Xref: 2 first lines, 2 second lines                                     at lib/Data/Edit/Xml/Xref.pm line 400
01:06:56 Test 030                                                                at (eval 113) line 2738
01:06:58 Xref: 7 refs, 1 duplicate id, 1 duplicate topic id                      at lib/Data/Edit/Xml/Xref.pm line 400
01:07:00 Xref: 7 refs, 1 duplicate id, 1 duplicate topic id                      at lib/Data/Edit/Xml/Xref.pm line 400
01:07:02 Xref: 6 refs, 1 duplicate id, 1 duplicate topic id                      at lib/Data/Edit/Xml/Xref.pm line 400
01:07:02 Test 031                                                                at (eval 113) line 3010
01:07:04 Xref: 104 refs, 21 image refs, 14 first lines, 14 second lines, 8 duplicate ids, 4 duplicate topic ids, 4 invalid guid hrefs, 2 duplicate files, 2 tables, 1 External xrefs with no format=html, 1 External xrefs with no scope=external, 1 file failed to parse, 1 href missing                                        at lib/Data/Edit/Xml/Xref.pm line 400
01:07:04 Test 033 Urls                                                           at (eval 113) line 3027
01:07:09 Xref: 2 urls                                                            at lib/Data/Edit/Xml/Xref.pm line 400
01:07:09 Tests finished:                                                         at (eval 113) line 3223
test.pl .. ok
All tests successful.
Files=1, Tests=125, 80 wallclock secs ( 0.02 usr  0.02 sys + 25.75 cusr 103.80 csys = 129.59 CPU)
Result: PASS

------------------------------
PREREQUISITES
------------------------------

Prerequisite modules loaded:

requires:

    Module             Need     Have    
    ------------------ -------- --------
    Carp               0        1.50    
    Data::Dump         0        1.23    
    Data::Edit::Xml    20200218 20200218
    Data::Table::Text  20200418 20200418
    Dita::GB::Standard 20190911 20190911
    perl               v5.26.1  5.031010
    Test2::API         0        1.302172
    Test::More         0        1.302172
    utf8               0        1.22    

configure_requires:

    Module             Need     Have    
    ------------------ -------- --------
    Module::Build      0.4224   0.4231  


------------------------------
ENVIRONMENT AND OTHER CONTEXT
------------------------------

Environment variables:

    AUTOMATED_TESTING = 1
    LANG = C
    PATH = /home/sand/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/local/perl/bin:/usr/X11/bin:/sbin:/usr/sbin
    PERL5LIB = /tmp/loop_over_bdir-31753-iDm7aS/Dita-GB-Standard-20190911-0/blib/arch:/tmp/loop_over_bdir-31753-iDm7aS/Dita-GB-Standard-20190911-0/blib/lib:/tmp/loop_over_bdir-31753-iDm7aS/Data-Edit-Xml-20200218-0/blib/arch:/tmp/loop_over_bdir-31753-iDm7aS/Data-Edit-Xml-20200218-0/blib/lib:/tmp/loop_over_bdir-31753-iDm7aS/XML-Parser-2.46-0/blib/arch:/tmp/loop_over_bdir-31753-iDm7aS/XML-Parser-2.46-0/blib/lib:/tmp/loop_over_bdir-31753-iDm7aS/Data-Table-Text-20200418-0/blib/arch:/tmp/loop_over_bdir-31753-iDm7aS/Data-Table-Text-20200418-0/blib/lib:/tmp/loop_over_bdir-31753-iDm7aS/Data-Dump-1.23-0/blib/arch:/tmp/loop_over_bdir-31753-iDm7aS/Data-Dump-1.23-0/blib/lib
    PERL5OPT = 
    PERL5_CPANPLUS_IS_RUNNING = 27730
    PERL5_CPAN_IS_RUNNING = 27730
    PERL_CANARY_STABILITY_NOPROMPT = 1
    PERL_MM_USE_DEFAULT = 1
    PERL_USE_UNSAFE_INC = 1
    SHELL = /usr/bin/zsh
    TERM = screen

Perl special variables (and OS-specific diagnostics, for MSWin32):

    $^X = /home/sand/src/perl/repoperls/installed-perls/host/k93buster/v5.31.10/9de7/bin/perl
    $UID/$EUID = 1005 / 1005
    $GID = 1005 1005
    $EGID = 1005 1005

Perl module toolchain versions installed:

    Module              Have    
    ------------------- --------
    CPAN                2.27    
    CPAN::Meta          2.150010
    Cwd                 3.78    
    ExtUtils::CBuilder  0.280234
    ExtUtils::Command   7.44    
    ExtUtils::Install   2.14    
    ExtUtils::MakeMaker 7.44    
    ExtUtils::Manifest  1.72    
    ExtUtils::ParseXS   3.40    
    File::Spec          3.78    
    JSON                4.02    
    JSON::PP            4.04    
    Module::Build       0.4231  
    Module::Signature   0.83    
    Parse::CPAN::Meta   2.150010
    Test::Harness       3.42    
    Test::More          1.302172
    YAML                1.30    
    YAML::Syck          1.32    
    version             0.9924  


--

Summary of my perl5 (revision 5 version 31 subversion 10) configuration:
  Commit id: e9526ab55c90efeae043256a53b4bebb489bc230
  Platform:
    osname=linux
    osvers=4.14.0-3-amd64
    archname=x86_64-linux-ld
    uname='linux k93buster 4.14.0-3-amd64 #1 smp debian 4.14.12-2 (2018-01-06) x86_64 gnulinux '
    config_args='-Dprefix=/home/sand/src/perl/repoperls/installed-perls/host/k93buster/v5.31.10/9de7 -Dmyhostname=k93buster -Dinstallusrbinperl=n -Uversiononly -Dusedevel -des -Ui_db -Dlibswanted=cl pthread socket inet nsl gdbm dbm malloc dl ld sun m crypt sec util c cposix posix ucb BSD gdbm_compat -Uuseithreads -Duselongdouble -DEBUGGING=-g'
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=undef
    usemultiplicity=undef
    use64bitint=define
    use64bitall=define
    uselongdouble=define
    usemymalloc=n
    default_inc_excludes_dot=define
    bincompat5005=undef
  Compiler:
    cc='cc'
    ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
    optimize='-O2 -g'
    cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion=''
    gccversion='8.3.0'
    gccosandvers=''
    intsize=4
    longsize=8
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=3
    ivtype='long'
    ivsize=8
    nvtype='long double'
    nvsize=16
    Off_t='off_t'
    lseeksize=8
    alignbytes=16
    prototype=define
  Linker and Libraries:
    ld='cc'
    ldflags =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/8/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib
    libs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.28.so
    so=so
    useshrplib=false
    libperl=libperl.a
    gnulibc_version='2.28'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E'
    cccdlflags='-fPIC'
    lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector-strong'


Characteristics of this binary (from libperl): 
  Compile-time options:
    HAS_TIMES
    PERLIO_LAYERS
    PERL_COPY_ON_WRITE
    PERL_DONT_CREATE_GVSV
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    PERL_USE_DEVEL
    USE_64_BIT_ALL
    USE_64_BIT_INT
    USE_LARGE_FILES
    USE_LOCALE
    USE_LOCALE_COLLATE
    USE_LOCALE_CTYPE
    USE_LOCALE_NUMERIC
    USE_LOCALE_TIME
    USE_LONG_DOUBLE
    USE_PERLIO
    USE_PERL_ATOF
  Built under linux
  Compiled at Mar 25 2020 04:19:55
  %ENV:
    PERL5LIB="/tmp/loop_over_bdir-31753-iDm7aS/Dita-GB-Standard-20190911-0/blib/arch:/tmp/loop_over_bdir-31753-iDm7aS/Dita-GB-Standard-20190911-0/blib/lib:/tmp/loop_over_bdir-31753-iDm7aS/Data-Edit-Xml-20200218-0/blib/arch:/tmp/loop_over_bdir-31753-iDm7aS/Data-Edit-Xml-20200218-0/blib/lib:/tmp/loop_over_bdir-31753-iDm7aS/XML-Parser-2.46-0/blib/arch:/tmp/loop_over_bdir-31753-iDm7aS/XML-Parser-2.46-0/blib/lib:/tmp/loop_over_bdir-31753-iDm7aS/Data-Table-Text-20200418-0/blib/arch:/tmp/loop_over_bdir-31753-iDm7aS/Data-Table-Text-20200418-0/blib/lib:/tmp/loop_over_bdir-31753-iDm7aS/Data-Dump-1.23-0/blib/arch:/tmp/loop_over_bdir-31753-iDm7aS/Data-Dump-1.23-0/blib/lib"
    PERL5OPT=""
    PERL5_CPANPLUS_IS_RUNNING="27730"
    PERL5_CPAN_IS_RUNNING="27730"
    PERL_CANARY_STABILITY_NOPROMPT="1"
    PERL_MM_USE_DEFAULT="1"
    PERL_USE_UNSAFE_INC="1"
  @INC:
    /tmp/loop_over_bdir-31753-iDm7aS/Dita-GB-Standard-20190911-0/blib/arch
    /tmp/loop_over_bdir-31753-iDm7aS/Dita-GB-Standard-20190911-0/blib/lib
    /tmp/loop_over_bdir-31753-iDm7aS/Data-Edit-Xml-20200218-0/blib/arch
    /tmp/loop_over_bdir-31753-iDm7aS/Data-Edit-Xml-20200218-0/blib/lib
    /tmp/loop_over_bdir-31753-iDm7aS/XML-Parser-2.46-0/blib/arch
    /tmp/loop_over_bdir-31753-iDm7aS/XML-Parser-2.46-0/blib/lib
    /tmp/loop_over_bdir-31753-iDm7aS/Data-Table-Text-20200418-0/blib/arch
    /tmp/loop_over_bdir-31753-iDm7aS/Data-Table-Text-20200418-0/blib/lib
    /tmp/loop_over_bdir-31753-iDm7aS/Data-Dump-1.23-0/blib/arch
    /tmp/loop_over_bdir-31753-iDm7aS/Data-Dump-1.23-0/blib/lib
    /home/sand/src/perl/repoperls/installed-perls/host/k93buster/v5.31.10/9de7/lib/site_perl/5.31.10/x86_64-linux-ld
    /home/sand/src/perl/repoperls/installed-perls/host/k93buster/v5.31.10/9de7/lib/site_perl/5.31.10
    /home/sand/src/perl/repoperls/installed-perls/host/k93buster/v5.31.10/9de7/lib/5.31.10/x86_64-linux-ld
    /home/sand/src/perl/repoperls/installed-perls/host/k93buster/v5.31.10/9de7/lib/5.31.10
    .