Bug #6489
closedGizmo issue with prefix, precede, suffix, and follow commands
0%
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¶
-
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.
-
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
Please register to edit this issue