Format for auto ids.
Oxygen general issues.
-
- Posts: 58
- Joined: Sat Aug 01, 2009 12:57 am
Format for auto ids.
I am looking at the auto generation of xml:id attribute in DocBook 5. The only documented variables for "ID Pattern" are ${localName} and ${uuid}. Is these more supported variables?
I am shooting for something like:
so my xml will be like
I am shooting for something like:
Code: Select all
${localName}.${elemPosition}
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<?oxygen RNGSchema="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng" type="xml"?>
<book xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
<chapter xml:id="chapter.1">
<title>Chapter Title</title>
<subtitle>Subtitle of Chapter</subtitle>
<sect1>
<title>Section1 Title</title>
<subtitle>Subtitle of Section 1</subtitle>
<para>Text</para>
</sect1>
</chapter>
<chapter xml:id="chapter.2">
<title>Chapter Title</title>
<subtitle>Subtitle of Chapter</subtitle>
<sect1>
<title>Section1 Title</title>
<subtitle>Subtitle of Section 1</subtitle>
<para>Text</para>
</sect1>
</chapter>
</book>
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Format for auto ids.
Post by sorin_ristache »
Hello,
In the current version only the variables ${localName} and ${uuid} are available for the ID pattern. We will consider allowing the creation of new variables or maybe the specification of the ID value using a custom Java class.
Regards,
Sorin
In the current version only the variables ${localName} and ${uuid} are available for the ID pattern. We will consider allowing the creation of new variables or maybe the specification of the ID value using a custom Java class.
Regards,
Sorin
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Format for auto ids.
Post by sorin_ristache »
Hello,
You can modify the class ro.sync.ecss.extensions.docbook.id.Docbook5UniqueAttributesRecognizer and return an instance of your modified version in the method ro.sync.ecss.extensions.api.ExtensionsBundle.getUniqueAttributesIdentifier(). You have to add your extension on the Classpath tab of the dialog for editing a document type and set your ExtensionBundle class on the Extensions tab of the same dialog.
Regards,
Sorin
You can modify the class ro.sync.ecss.extensions.docbook.id.Docbook5UniqueAttributesRecognizer and return an instance of your modified version in the method ro.sync.ecss.extensions.api.ExtensionsBundle.getUniqueAttributesIdentifier(). You have to add your extension on the Classpath tab of the dialog for editing a document type and set your ExtensionBundle class on the Extensions tab of the same dialog.
Regards,
Sorin
-
- Posts: 58
- Joined: Sat Aug 01, 2009 12:57 am
Re: Format for auto ids.
Thanks. It seems like I'll have to override the docbook ExtensionBundle.
Any idea on how to do something like this:
Original Document
then i insert another chapter in the middle a get this
Any idea on how to do something like this:
Original Document
Code: Select all
<book xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
<chapter xml:id="chapter.1">...<xref linkend="chapter.2"/></chapter>
<chapter xml:id="chapter.2">...</chapter>
</book>
Code: Select all
<book xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
<chapter xml:id="chapter.1">...<xref linkend="chapter.3"/></chapter>
<chapter xml:id="chapter.2">New Chapter</chapter>
<chapter xml:id="chapter.3">...</chapter>
</book>
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Format for auto ids.
Post by sorin_ristache »
Do you mean to insert a new chapter with the ID chapter.2 and rename the ID of the existing chapter from chapter.2 to chapter.3 in both the xml:id and the linkend attribute? You have to write an Author extension that inserts a chapter element at the cursor location (for inserting the new chapter.2 element) and at the same time finds the next sibling chapter element and the xref element that has the same linkend attribute as the xml:id attribute of the sibling chapter element. You find both elements using authorAccess.getDocumentController().findNodesByXPath(). After that you change both attribute values (chapter/@xml:id and xref/@linkend).
Regards,
Sorin
Regards,
Sorin
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