Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XSLT output differs from Saxon #18

Closed
david-waltermire opened this issue May 10, 2022 · 3 comments · Fixed by #150
Closed

XSLT output differs from Saxon #18

david-waltermire opened this issue May 10, 2022 · 3 comments · Fixed by #150
Assignees
Labels
bug Something isn't working

Comments

@david-waltermire
Copy link
Collaborator

Describe the bug

liboscal-java provides different indentation to XSLT output from Saxon.

Who is the bug affecting?

Users using both liboscal-java and Saxon. Noting official project usage as outlined in the documentation.

What is affected by this bug?

Indentation consistency.

When does this occur?

On profile resolution.

How do we replicate the issue?

Given the below input based on Saxon (latest release) formatting:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../example-checkup.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<!-- Modified by conversion XSLT 2021-04-05T11:12:31.584-04:00 - RC2 OSCAL becomes RC3 OSCAL -->
<catalog xmlns="http://csrc.nist.gov/ns/oscal/1.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         uuid="6c5149e8-f3a6-437c-8035-025e9b5fc0bf"
         xsi:schemaLocation="http://csrc.nist.gov/ns/oscal/1.0 ../../../../../xml/schema/oscal_catalog_schema.xsd">
   <metadata>
      <title>Alphabet Catalog</title>
      <last-modified>2020-05-30T14:51:41.185-04:00</last-modified>
      <version>1.0</version>
      <oscal-version>1.0.0-rc2</oscal-version>
   </metadata>
   <group>
      <title>Group A of C</title>
      <control id="a1">
         <title>Control A1</title>
         <param id="a1_prm1">
            <label>A1 Parameter 1</label>
         </param>
         <prop name="label" value="first"/>
         <part name="statement" id="a1-stmt">
            <p>A1 <strong>aaa</strong>aa aaaaaaaaaa</p>
         </part>
      </control>
      <control id="a2">
         <title>Control A2</title>
         <prop name="label" value="second"/>
         <part name="statement" id="a2-stmt">
            <p>A2 aaa aaaaaaaaaa aaaaaaaaaaaaa</p>
         </part>
      </control>
      <control id="a3">
         <title>Control A3</title>
         <param id="a3_prm1">
            <label>A3 Parameter 1</label>
         </param>
         <prop name="label" value="third"/>
         <part name="statement" id="a3-stmt">
            <p>A3 aaaaa aaaaaaaaaa</p>
         </part>
      </control>
   </group>
   <group>
      <title>Group B of C</title>
      <control id="b1">
         <title>Control B1</title>
         <prop name="label" value="fourth"/>
         <part name="statement" id="b1-stmt">
            <p>B1 bbbb bbbbbbb.</p>
         </part>
      </control>
      <control id="b2">
         <title>Control B2</title>
         <prop name="label" value="fifth"/>
         <part name="statement" id="b2-stmt">
            <p>B2 bbb bbbbbbbbbbb bbbbbbbbbbbb.</p>
         </part>
      </control>
      <control id="b3">
         <title>Control B3</title>
         <prop name="label" value="sixth"/>
         <part name="statement" id="b3-stmt">
            <p>B3 bbbb bbbbbbb bbbb.</p>
         </part>
      </control>
   </group>
   <group>
      <title>Group C of C</title>
      <control id="c1">
         <title>Control C1</title>
         <prop name="label" value="seventh"/>
         <part name="statement" id="c1-stmt">
            <p>C1 ccccc ccc ccccccccccccccccc.</p>
         </part>
      </control>
      <control id="c2">
         <title>Control C2</title>
         <prop name="label" value="eighth"/>
         <part name="statement" id="c2-stmt">
            <p>C2 cccccccc ccccccccccccccccc.</p>
         </part>
      </control>
      <control id="c3">
         <title>Control C3</title>
         <prop name="label" value="ninth"/>
         <part name="statement" id="c3-stmt">
            <p>C3 ccccc cccccccccccccc.</p>
         </part>
         <control id="c3.a">
            <title>Control C3-A</title>
            <prop name="label" value="tenth"/>
            <part name="statement" id="c3-stmt">
               <p>C3 A ccccc cccccccccccccc.</p>
            </part>
            <control id="c3.a-1">
               <title>Control C3-A-1</title>
               <prop name="label" value="eleventh"/>
               <part name="statement" id="c3-stmt">
                  <p>C3 A-1 ccccc cccccccccccccc.</p>
               </part>
            </control>
         </control>
      </control>
   </group>
</catalog>

Actual:

<?xml version='1.0' encoding='UTF-8'?>
<catalog xmlns="http://csrc.nist.gov/ns/oscal/1.0" uuid="6c5149e8-f3a6-437c-8035-025e9b5fc0bf">
  <metadata>
    <title>Alphabet Catalog</title>
    <last-modified>2020-05-30T14:51:41.185-04:00</last-modified>
    <version>1.0</version>
    <oscal-version>1.0.0-rc2</oscal-version>
    <revisions/>
  </metadata>
  <group>
    <title>Group A of C</title>
    <control id="a1">
      <title>Control A1</title>
      <param id="a1_prm1">
        <label>A1 Parameter 1</label>
      </param>
      <prop name="label" value="first"/>
      <part id="a1-stmt" name="statement">
        <p>A1 
          <strong>aaa</strong>aa aaaaaaaaaa
        </p>
      </part>
    </control>
    <control id="a2">
      <title>Control A2</title>
      <prop name="label" value="second"/>
      <part id="a2-stmt" name="statement">
        <p>A2 aaa aaaaaaaaaa aaaaaaaaaaaaa</p>
      </part>
    </control>
    <control id="a3">
      <title>Control A3</title>
      <param id="a3_prm1">
        <label>A3 Parameter 1</label>
      </param>
      <prop name="label" value="third"/>
      <part id="a3-stmt" name="statement">
        <p>A3 aaaaa aaaaaaaaaa</p>
      </part>
    </control>
  </group>
  <group>
    <title>Group B of C</title>
    <control id="b1">
      <title>Control B1</title>
      <prop name="label" value="fourth"/>
      <part id="b1-stmt" name="statement">
        <p>B1 bbbb bbbbbbb.</p>
      </part>
    </control>
    <control id="b2">
      <title>Control B2</title>
      <prop name="label" value="fifth"/>
      <part id="b2-stmt" name="statement">
        <p>B2 bbb bbbbbbbbbbb bbbbbbbbbbbb.</p>
      </part>
    </control>
    <control id="b3">
      <title>Control B3</title>
      <prop name="label" value="sixth"/>
      <part id="b3-stmt" name="statement">
        <p>B3 bbbb bbbbbbb bbbb.</p>
      </part>
    </control>
  </group>
  <group>
    <title>Group C of C</title>
    <control id="c1">
      <title>Control C1</title>
      <prop name="label" value="seventh"/>
      <part id="c1-stmt" name="statement">
        <p>C1 ccccc ccc ccccccccccccccccc.</p>
      </part>
    </control>
    <control id="c2">
      <title>Control C2</title>
      <prop name="label" value="eighth"/>
      <part id="c2-stmt" name="statement">
        <p>C2 cccccccc ccccccccccccccccc.</p>
      </part>
    </control>
    <control id="c3">
      <title>Control C3</title>
      <prop name="label" value="ninth"/>
      <part id="c3-stmt" name="statement">
        <p>C3 ccccc cccccccccccccc.</p>
      </part>
      <control id="c3.a">
        <title>Control C3-A</title>
        <prop name="label" value="tenth"/>
        <part id="c3-stmt" name="statement">
          <p>C3 A ccccc cccccccccccccc.</p>
        </part>
        <control id="c3.a-1">
          <title>Control C3-A-1</title>
          <prop name="label" value="eleventh"/>
          <part id="c3-stmt" name="statement">
            <p>C3 A-1 ccccc cccccccccccccc.</p>
          </part>
        </control>
      </control>
    </control>
  </group>
</catalog>

Expected behavior (i.e. solution)

Consistency between the tools. See <strong> node in the below.

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../../example-checkup.sch" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<!-- Modified by conversion XSLT 2021-04-05T11:12:31.584-04:00 - RC2 OSCAL becomes RC3 OSCAL -->
<catalog xmlns="http://csrc.nist.gov/ns/oscal/1.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         uuid="6c5149e8-f3a6-437c-8035-025e9b5fc0bf"
         xsi:schemaLocation="http://csrc.nist.gov/ns/oscal/1.0 ../../../../../xml/schema/oscal_catalog_schema.xsd">
   <metadata>
      <title>Alphabet Catalog</title>
      <last-modified>2020-05-30T14:51:41.185-04:00</last-modified>
      <version>1.0</version>
      <oscal-version>1.0.0-rc2</oscal-version>
   </metadata>
   <group>
      <title>Group A of C</title>
      <control id="a1">
         <title>Control A1</title>
         <param id="a1_prm1">
            <label>A1 Parameter 1</label>
         </param>
         <prop name="label" value="first"/>
         <part name="statement" id="a1-stmt">
            <p>A1 <strong>aaa</strong>aa aaaaaaaaaa</p>
         </part>
      </control>
      <control id="a2">
         <title>Control A2</title>
         <prop name="label" value="second"/>
         <part name="statement" id="a2-stmt">
            <p>A2 aaa aaaaaaaaaa aaaaaaaaaaaaa</p>
         </part>
      </control>
      <control id="a3">
         <title>Control A3</title>
         <param id="a3_prm1">
            <label>A3 Parameter 1</label>
         </param>
         <prop name="label" value="third"/>
         <part name="statement" id="a3-stmt">
            <p>A3 aaaaa aaaaaaaaaa</p>
         </part>
      </control>
   </group>
   <group>
      <title>Group B of C</title>
      <control id="b1">
         <title>Control B1</title>
         <prop name="label" value="fourth"/>
         <part name="statement" id="b1-stmt">
            <p>B1 bbbb bbbbbbb.</p>
         </part>
      </control>
      <control id="b2">
         <title>Control B2</title>
         <prop name="label" value="fifth"/>
         <part name="statement" id="b2-stmt">
            <p>B2 bbb bbbbbbbbbbb bbbbbbbbbbbb.</p>
         </part>
      </control>
      <control id="b3">
         <title>Control B3</title>
         <prop name="label" value="sixth"/>
         <part name="statement" id="b3-stmt">
            <p>B3 bbbb bbbbbbb bbbb.</p>
         </part>
      </control>
   </group>
   <group>
      <title>Group C of C</title>
      <control id="c1">
         <title>Control C1</title>
         <prop name="label" value="seventh"/>
         <part name="statement" id="c1-stmt">
            <p>C1 ccccc ccc ccccccccccccccccc.</p>
         </part>
      </control>
      <control id="c2">
         <title>Control C2</title>
         <prop name="label" value="eighth"/>
         <part name="statement" id="c2-stmt">
            <p>C2 cccccccc ccccccccccccccccc.</p>
         </part>
      </control>
      <control id="c3">
         <title>Control C3</title>
         <prop name="label" value="ninth"/>
         <part name="statement" id="c3-stmt">
            <p>C3 ccccc cccccccccccccc.</p>
         </part>
         <control id="c3.a">
            <title>Control C3-A</title>
            <prop name="label" value="tenth"/>
            <part name="statement" id="c3-stmt">
               <p>C3 A ccccc cccccccccccccc.</p>
            </part>
            <control id="c3.a-1">
               <title>Control C3-A-1</title>
               <prop name="label" value="eleventh"/>
               <part name="statement" id="c3-stmt">
                  <p>C3 A-1 ccccc cccccccccccccc.</p>
               </part>
            </control>
         </control>
      </control>
   </group>
</catalog>

Other Comments

@david-waltermire
Copy link
Collaborator Author

david-waltermire commented Jul 3, 2023

The new version of oscal-cli does not attempt to pretty print the conversion result, as this can be rather problematic, as seen by this issue. Since the output is not pretty printed, this issue is no longer a problem.

@aj-stein-nist
Copy link
Collaborator

aj-stein-nist commented Jul 5, 2023

The new version of oscal-cli does not attempt to pretty print the conversion result, as this can be rather problematic, as seen by this issue. Since the output is not pretty printed, this issue is no longer a problem.

As in: you recommend this be closed as WONTFIX because we will not try to align the output at all anymore? I want to make sure I understand, but I can definitely agree with that approach. Disregard, I saw updated communication on issue and PR tracking. It addressed this question.

@aj-stein-nist aj-stein-nist linked a pull request Jul 5, 2023 that will close this issue
8 tasks
@aj-stein-nist
Copy link
Collaborator

Now closed with release of 2.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants