Generate @id based on child title?
Are you missing a feature? Request its implementation here.
-
- Posts: 156
- Joined: Sat Feb 26, 2005 12:09 am
- Location: USA
- Contact:
Generate @id based on child title?
Post by shudson310 »
I found a way to set the ID options (framework -> ID Options), but haven't found a way to set the ID based on the value from a title child element.
For example, if I have:
I want to configure the Generate IDs to use the ${localName}_{$childTitle} such that the following is generated:
If a new section is being inserted (and thus no title yet), the author could be prompted for the title, which would insert the <title> element and populate the @id appropriately.
For example, if I have:
Code: Select all
<section>
<title>Configuring the radio</title>
<p>blah</p>
</section>
Code: Select all
<section id="section_ConfiguringTheRadio>
<title>Configuring the radio</title>
<p>blah</p>
</section>
Scott Hudson
Staff Content Engineer
Site: docs.servicenow.com
Staff Content Engineer
Site: docs.servicenow.com
Re: Generate @id based on child title?
Hi Scott,
We do not have such functionality, especially that new elements are usually inserted with an empty title (or no title at all) and somehow the ID usually needs to be generated when the title is not available. Also the title may be modified in time... should the ID be regenerated also?
About this remark:
Another approach is to create an Author action based on a Javascript code which uses our API to insert an XML fragment, like:
https://github.com/oxygenxml/javascript ... bute-value
Once you have a custom Author action, you can decide to replace the content completion window item which inserts a <section> with the action.
Regards,
Radu
We do not have such functionality, especially that new elements are usually inserted with an empty title (or no title at all) and somehow the ID usually needs to be generated when the title is not available. Also the title may be modified in time... should the ID be regenerated also?
About this remark:
You can create a custom Author action which inserts the <section> element using editor variables. We have an editor variable called ${ask} which shows a message dialog to the end user allowing them to input some text. In Oxygen 20.1 which we plan to release in a couple of days you will have the ability to ask the end user for the title and then use it in multiple places in the inserted XML fragment. A problem I see is that for the ID you need to further process the title, remove spaces, lowercase letters, etc. We have another editor variable called xpath_eval which may be useful for this https://www.oxygenxml.com/doc/versions/ ... ables.html. After Oxygen 20.1 is released I will try to maybe put together a few steps in a blog post and update this issue.If a new section is being inserted (and thus no title yet), the author could be prompted for the title, which would insert the <title> element and populate the @id appropriately.
Another approach is to create an Author action based on a Javascript code which uses our API to insert an XML fragment, like:
https://github.com/oxygenxml/javascript ... bute-value
Once you have a custom Author action, you can decide to replace the content completion window item which inserts a <section> with the action.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
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