Special entity & breaks in custom refactoring XQuery Update operation
Issues related to W3C XQuery.
-
- Posts: 14
- Joined: Tue Aug 28, 2018 3:51 pm
Special entity & breaks in custom refactoring XQuery Update operation
My XML file contains two predefined XML entities: """ and "&".
I am confused by the following behaviour:
* when I run my XQU script using a transformation scenario, the entities are untouched (= everything is OK)
* when I run my XQU script using a custom refactoring operation, the entities are expanded. This leads to my XML not well-formed ("&" is changed to "&")
I have followed the instructions on: https://www.oxygenxml.com/doc/versions/ ... _operation
How can I run an XQU script using a custom refactoring operation that leaves the entities untouched?
Oxygen 19.1
XQuery:
-tree:linked
-ext
-update:on
I am confused by the following behaviour:
* when I run my XQU script using a transformation scenario, the entities are untouched (= everything is OK)
* when I run my XQU script using a custom refactoring operation, the entities are expanded. This leads to my XML not well-formed ("&" is changed to "&")
I have followed the instructions on: https://www.oxygenxml.com/doc/versions/ ... _operation
How can I run an XQU script using a custom refactoring operation that leaves the entities untouched?
Oxygen 19.1
XQuery:
-tree:linked
-ext
-update:on
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Special entity & breaks in custom refactoring XQuery Update operation
Hi,
We have a predefined XQuery script for converting attributes to elements (OXYGEN_INSTALL_DIR\refactoring\convert-attribute-to-element.xq), I tried to use the conversion on an XML which has both " and & but I cannot reproduce the problem (I tested with both Oxygen 19.1 and 20.1).
Would it be possible for you to send us a sample XQuery update operation (XML descriptor + Xquery + maybe sample XML document) with which we could reproduce the problem on our side? You can also send us an email to support@oxygenxml.com if you do not want to paste the script here.
Regards,
Radu
We have a predefined XQuery script for converting attributes to elements (OXYGEN_INSTALL_DIR\refactoring\convert-attribute-to-element.xq), I tried to use the conversion on an XML which has both " and & but I cannot reproduce the problem (I tested with both Oxygen 19.1 and 20.1).
Would it be possible for you to send us a sample XQuery update operation (XML descriptor + Xquery + maybe sample XML document) with which we could reproduce the problem on our side? You can also send us an email to support@oxygenxml.com if you do not want to paste the script here.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 14
- Joined: Tue Aug 28, 2018 3:51 pm
Re: Special entity & breaks in custom refactoring XQuery Update operation
Thanks. I tried the script you named, it works without problems.
Can you reproduce with the following script? Am I missing something in the serialisation options? Again, it works in the transformation scenario and only fails when called from the XML refactoring menu.
Input:
XQuery Update:
Output:
Thanks for having a look.
Can you reproduce with the following script? Am I missing something in the serialisation options? Again, it works in the transformation scenario and only fails when called from the XML refactoring menu.
Input:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<root>
<text>A & B is "C"</text>
<fn typ="manuell" position="fussnote" id="fn0001">
<kennung>X</kennung>
<absatz>Regulation & Management.</absatz>
</fn>
</root>
Code: Select all
declare namespace saxon="http://saxon.sf.net/";
declare option saxon:output "method=xml";
declare option saxon:output "indent=no";
let $fn_all := doc(document-uri(/))/root/descendant::fn
for $fn in $fn_all
let $this_att_typ := $fn/@typ
let $this_att_position := $fn/@position
let $fn_count := count($fn/preceding::fn[@position eq $this_att_position])+1
let $kennung := <kennung>{$fn_count}</kennung>
return
(
delete node $fn/kennung,
insert node $kennung as first into $fn,
replace value of node $this_att_typ with 'manuell'
)
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<root>
<text>A & B is "C"</text>
<fn typ="manuell" position="fussnote" id="fn0001"><kennung>1</kennung>
<absatz>Regulation & Management.</absatz>
</fn>
</root>
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Special entity & breaks in custom refactoring XQuery Update operation
Hi,
I can reproduce the problem with your samples, we'll look into fixing this, I will update this forum thread when we do. If I find a workaround for this current behavior I will update this forum thread. in the meantime you could try to use an XSLT script instead.
Regards,
Radu
I can reproduce the problem with your samples, we'll look into fixing this, I will update this forum thread when we do. If I find a workaround for this current behavior I will update this forum thread. in the meantime you could try to use an XSLT script instead.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Special entity & breaks in custom refactoring XQuery Update operation
Hi,
Found a workaround, replace:
with:
Regards,
Radu
Found a workaround, replace:
Code: Select all
let $fn_all := doc(document-uri(/))/root/descendant::fn
Code: Select all
let $fn_all := /root/descendant::fn
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 14
- Joined: Tue Aug 28, 2018 3:51 pm
Re: Special entity & breaks in custom refactoring XQuery Update operation
Thank you Radu, this works.
Only issue there is with this workaround there is an error from Saxon in the transformation scenario:
Programmname: Saxon-EE XQuery 9.7.0.19
Fehlerlevel: warning
Beschreibung: net.sf.saxon.tree.linked.DocumentImpl@754b7981 Updated document discarded because it was not read using doc()
I hope this can be fixed in the future so that we can use the same Xquery Update scripts in both, refactoring and transformation scenarios.
Thanks again, appreciate your quick help.
Only issue there is with this workaround there is an error from Saxon in the transformation scenario:
Programmname: Saxon-EE XQuery 9.7.0.19
Fehlerlevel: warning
Beschreibung: net.sf.saxon.tree.linked.DocumentImpl@754b7981 Updated document discarded because it was not read using doc()
I hope this can be fixed in the future so that we can use the same Xquery Update scripts in both, refactoring and transformation scenarios.
Thanks again, appreciate your quick help.
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service