How to modify attributes with editor variables?
Oxygen general issues.
-
- Posts: 26
- Joined: Wed Jun 26, 2013 1:08 am
How to modify attributes with editor variables?
Post by avanlooveren »
I need to replace all attributes with a particular name in a single document to have a value of UUID (the editor variable "{uuid}"). I don't think Find/Replace, even with regex, is capable of this.
I'm trying to configure a custom Author action with ChangeAttributeOperation, but I wonder if I'm going about this all wrong. I set the elementLocation to "//*", but I cannot seem to get more than one attribute value to update.
Any help appreciated. Also, is it possible to enable this in Text mode? Thanks!
I'm trying to configure a custom Author action with ChangeAttributeOperation, but I wonder if I'm going about this all wrong. I set the elementLocation to "//*", but I cannot seem to get more than one attribute value to update.
Any help appreciated. Also, is it possible to enable this in Text mode? Thanks!
-
- Posts: 417
- Joined: Mon May 09, 2016 9:37 am
Re: How to modify attributes with editor variables?
Post by sorin_carbunaru »
Hello,
You could use a custom XML Refactoring operation (https://www.oxygenxml.com/doc/versions/ ... tions.html). I did just that to see if it works (and it does work), starting from the default Add/Change attribute operation, and instead of requesting an attribute value from the user, I generated one in the operation's XQuery script, using the generate-id() function.
You can find my try at http://www.oxygenxml.com/forum/files/cu ... ibutes.zip.
Best regards,
Sorin Carbunaru
oXygen XML
You could use a custom XML Refactoring operation (https://www.oxygenxml.com/doc/versions/ ... tions.html). I did just that to see if it works (and it does work), starting from the default Add/Change attribute operation, and instead of requesting an attribute value from the user, I generated one in the operation's XQuery script, using the generate-id() function.
You can find my try at http://www.oxygenxml.com/forum/files/cu ... ibutes.zip.
Best regards,
Sorin Carbunaru
oXygen XML
-
- Posts: 26
- Joined: Wed Jun 26, 2013 1:08 am
Re: How to modify attributes with editor variables?
Post by avanlooveren »
Sorin,
First, a big THANK YOU. You and your team are always so thorough with your responses and this was no exception.
Priorities shifted, so a lot of time passed before I got to try out your solution, but it works. (Of course, it does, and of course your wonderful product was ready to address my need.)
My tweak, since I did want UUID and not the "element position" that generate-id() produces, was to supplement your provided XQuery with:
and then use
Thanks again,
-Andre
First, a big THANK YOU. You and your team are always so thorough with your responses and this was no exception.
Priorities shifted, so a lot of time passed before I got to try out your solution, but it works. (Of course, it does, and of course your wonderful product was ready to address my need.)
My tweak, since I did want UUID and not the "element position" that generate-id() produces, was to supplement your provided XQuery with:
Code: Select all
declare namespace uuid = "java:java.util.UUID"
Code: Select all
uuid:randomUUID()
-Andre
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