How can I reference text() nodes in the built-in "Delete element" refactoring operation?
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
How can I reference text() nodes in the built-in "Delete element" refactoring operation?
Post by chrispitude »
I would like to use Oxygen's built-in Elements > Delete element refactoring operation to delete text() nodes in <p> elements.
Given some XML like
I would like to delete the text and leave the <xref>:
However, when I try XPath expressions such as
the refactoring operation tells me "Could not find any resources that would be affected by this operation." I also found that if I tried to delete every node() in <p> elements:
then it would delete named elements but leave the text() nodes:
Somehow the text() nodes are invincible to the Elements > Delete element refactoring operation. Is there a trick to referencing them from the XPath expression textbox?
Given some XML like
Code: Select all
<p>See <xref .../> for more information.</p>
Code: Select all
<p><xref .../></p>
Code: Select all
p/text()
p/self::text()
Code: Select all
p/node()
Code: Select all
<p>See for more information.</p>
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: How can I reference text() nodes in the built-in "Delete element" refactoring operation?
Hi Chris,
The "Delete element" refactoring operation does what it says, it matches and deletes only XML elements.
It's implemented with XQuery update, the script is located in "OXYGEN_INSTALL_DIR/refactoring/delete-element.xq".
I'm not sure if we should create another predefined refactoring action for deleting text, it does not look like a very frequent use case.
Regards,
Radu
The "Delete element" refactoring operation does what it says, it matches and deletes only XML elements.
It's implemented with XQuery update, the script is located in "OXYGEN_INSTALL_DIR/refactoring/delete-element.xq".
I'm not sure if we should create another predefined refactoring action for deleting text, it does not look like a very frequent use case.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: How can I reference text() nodes in the built-in "Delete element" refactoring operation?
Post by chrispitude »
Hi Radu,
Ahh, that makes sense! The refactoring operation is fine as-is, I just got confused because other XPath-like things worked in the pattern.
Here is the reason I asked the question:
topic23614.html: Deleting everything except cross-reference structure from a book
Ahh, that makes sense! The refactoring operation is fine as-is, I just got confused because other XPath-like things worked in the pattern.
Here is the reason I asked the question:
topic23614.html: Deleting everything except cross-reference structure from a book
Return to “General XML Questions”
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