Project

Profile

Help

Bug #6489

open

Gizmo issue with prefix, precede, suffix, and follow commands

Added by A Galtman 2 days ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2024-07-25
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

I'm new to Gizmo, and I am seeing unexpected behavior with the prefix, precede, suffix, and follow commands. I have attached ZIP-files with the files that I mention below.

Reproduction steps for issue 1

  1. Set SAXON_CP environment variable to the Saxon-HE 12.5 jar file path, followed by a path separator, followed by the jline-2.14.6.jar file path.

  2. java -cp "%SAXON_CP%" net.sf.saxon.Gizmo -q:script.txt

Contents of script.txt:

load source.xml
prefix /article/info with /article/abstract
save result-of-prefix.xml
load source.xml
precede /article/info/author with /article/abstract
save result-of-precede.xml
load source.xml
suffix /article/info with /article/abstract
save result-of-suffix.xml
load source.xml
follow /article/info/author with /article/abstract
save result-of-follow.xml

Contents of source.xml:

<?xml version="1.0" encoding="UTF-8"?>
<article>
  <info>
    <author/>
  </info>
  <abstract/>
</article>

Expected results:

All four generated files should have one <author/> element, the original <abstract/> element near the end, and one newly inserted <abstract/> element inside <info>.

Actual results:

  • The result-of-prefix.xml and result-of-precede.xml files each have two <author/> elements, as shown in the code block below.
  • The result-of-suffix.xml and result-of-follow.xml files are as expected.

Contents of result-of-prefix.xml:

<?xml version="1.0" encoding="UTF-8"?><article>
  <info><abstract/>
    <author/>
  </info>
  <abstract/>
    <author/>
  </article>

Reproduction steps for issue 2

When I tried the follow and suffix commands in a document having six siblings within a top-level element, I didn't understand those commands' behaviors, either. Elements are disappearing, but the documentation only mentions the insertion of content (not replacement or deletion).

java -cp "%SAXON_CP%" net.sf.saxon.Gizmo
Saxon Gizmo 12.5
/>load six-siblings.xml
/>show
<root>
   <a/>
   <b/>
   <c/>
   <d/>
   <e/>
   <f/>
</root>

/>follow /root/a with /root/e
/>show
<root>
   <a/>
   <e/>
   <f/>
</root>

/>load six-siblings.xml
/>follow //a with //e
/>show
<root>
   <a/>
   <e/>
   <f/>
</root>

/>load six-siblings.xml
/>suffix /root/a with /root/e
/>show
<root>
   <a>
      <e/>
   </a>
   <b/>
   <c/>
   <d/>
   <e/>
</root>

/>load six-siblings.xml
/>suffix //a with //e
/>show
<root>
   <a>
      <e/>
   </a>
   <b/>
   <c/>
   <d/>
   <e/>
</root>

/>quit now

Files

gizmo-precede-prefix.zip (1.2 KB) gizmo-precede-prefix.zip Repro steps issue 1 A Galtman, 2024-07-25 19:26
six-siblings.xml (96 Bytes) six-siblings.xml Repro steps issue 2 A Galtman, 2024-07-25 19:39

No data to display

Please register to edit this issue

Also available in: Atom PDF