cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

inserting tags with in another tags by default/arbortext-Editor

rnavath
1-Newbie

inserting tags with in another tags by default/arbortext-Editor


Hi developers,

I want to insert some tags with in other tags by default in Arbortext Editor. Ex: when I insert Table tag , title should insert by default without changing optional to required in DTD. Is it possible with DCF files or FOSI files?


Regards,
Roopesh Navath

8 REPLIES 8

Roopesh,



Yes it is, at least to a degree. In your 'set commands' there is an option
called 'set addrequiredtags' (help 9181) that will provide pretty much what
you want.

There are some limits, only 'required' tags are inserted and only if the
insertion will not cause parsing errors.



Go to the menu select 'tools|preferences' then click on the 'edit' category
and check the box to 'insert required elements' then click OK.



Lynn


Hi Developers,

Thanks you for the mail.

So only required tag can insert by default. I am looking if there any option to insert optional tag by default by changing any arbortext files and Without editing original DTD.

Thanks,

Roopesh

Roopesh,



No, inserting optional tags can be counterproductive. If you do not want it,
then you must remove it.



If you feel you need the tag all the time then consider changing the
DTD/Schema to make it required.



Epic is reading the DTD/schema and has no way of knowing what your
individual requirements are.



All that aside, you could write an ACL or similar script to insert specific
tags at a given time. HOWEVER, this would require the script to be running
continuously and could easily slow your authoring process down as it will be
a system resource hog.



One last option is you might be able (and I do not use this feature so I am
purely guessing), is make an 'alias' tag that has the elements you want as
required and then possibly the 'set addrequiredtags' would insert the
elements you want.





Lynn


Hi,

Thank you for the quick reply.

I will tell my requirement.


1. As per requirement from client, I made optional alt tag in image and title tag in table made required(mandatory) in main DTD. The problem is the existing publications(topics) in repository getting fail which do not have title in table and alt tag in image.

2. Customer want to add some tags by default in Arbortext editor to reduce writers effort by adding tags manually. So I am trying to make these changes only for arbortext editor.

Can you suggest any idea how to resolve without failing existing publication?

Thanks and regards
Roopesh N

Roopesh,

If I understand your question correctly, you can autoinsert elements by configuring the .dcf file for your doctype.

From the Arbortext Help Center:

Inserting elements and text automatically
You can configure a list of elements and text in the .dcf file that Arbortext Editor automatically inserts when an element is inserted.
For example, you can configure your document type so that when Arbortext Editor users convert text within a paragraph to a list, both list wrapper and list item tags are automatically inserted around any selected text.
To configure automatic element and text insertion:

1

Open Arbortext Architect.



2

Choose File ▶ Open.



3

Locate the directory in which the document type whose .dcf file you want to modify is saved, and click Select.



4

Once the document type is loaded, choose Edit ▶ DCF. If the document type has a .dcf file, it displays in the Arbortext Architect DCF Editor window. If there is no .dcf file associated with this document type, Arbortext Architect automatically creates one.



5

Locate the ContextTransformations element in the DCF Editor. If the file doesn't include a ContextTransformations element, add one.
Note
Open the Document Type Viewer (Tools ▶ Document Type Viewer) to view the element hierarchy for the .dcf file. This will help you determine the valid location for the ContextTransformations element.



6

Place your cursor next to the ContextTransformations element, choose Insert ▶ Markup, and then choose InsertAutoWithin.



7

Click next to the InsertAutoWithin element to open the Modify Attributes dialog box.
Note
You must have the Force Required Attributes Entry Edit preference<">http://localhost:61759/aeHelp/help469.html> selected for this dialog box to open automatically.



8

In the element field, select the element for which you want to create a automatic insertions.



9

Click OK.



10

In the DCF Editor, highlight the InsertAutoWithin element, and choose Edit ▶ Edit Selection as XML Source.



11

Add the elements that you want to be automatically inserted when the element identified in the previous step is inserted in a document. You must provide a namespace prefix<">http://localhost:61759/dtGuide/help5009.html#help5009> for elements you are inserting.
Note
You must conform to XML syntax for the contents of the InsertAutoWithin for both XML and SGML document types. Singleton tags should be written as <namespace:singleton/>.
Also, spaces or line feeds inside the InsertAutoWithin contents are recognized as such.cc
For example,
<insertautowithin element="author" xmlns:axdocbook-customized="axdocbook-customized.dtd">
<axdocbook-customized:honorific>Dr.</axdocbook-customized:honorific></insertautowithin>
would automatically insert the honorific element with Dr. as the content when author is inserted.



12

Specify the cursor location after an automatic insert. The InsertAutoCaret tag indicates where the cursor will be after the insertion is completed. If you do not specify a cursor location, the cursor is placed after the inserted element.
In the following example, the cursor will be placed within the firstname tags:
<insertautowithin element="author" xmlns:axdocbook-customized="axdocbook-customized.dtd">
<axdocbook-customized:honorific>Dr.</axdocbook-customized:honorific>
<axdocbook-customized:firstname><insertautocaret/></axdocbook-customized:firstname>



13

Specify the insertion location. The InsertAutoSelection indicates where existing content is placed (when you're inserting an element around content). If you do not specify InsertAutoSelection, existing content will go after the automatically inserted content.
In the following example, the existing content will be placed within the surname tags:
<insertautowithin element="author" xmlns:axdocbook-customized="axdocbook-customized.dtd">
<axdocbook-customized:honorific>Dr.</axdocbook-customized:honorific>
<axdocbook-customized:firstname><insertautocaret/></axdocbook-customized:firstname>
<axdocbook-customized:surname><insertautoselection/></axdocbook-customized:surname>



14

Choose File ▶ Update Selection in the XML Source window to return to the DCF Editor.



15

Choose File ▶ Save to save the changes you have made to the .dcf file.

Note
When authors add markup using the Table Editor, only the cell element receives InsertAutoWithin content


Lisa Gillispie

Hi Roopesh,

You should look into callbacks generally and the insert_tag_after callback
specifically. This callback will let you test an inserted tag and if it is
found to be a table, you can insert the title. This should not cause
performance issues.


On Wed, May 28, 2014 at 7:36 AM, Roopesh Navath
<->wrote:

> Hi,
>
>
>
> Thank you for the quick reply.
>
>
>
> I will tell my requirement.
>
>
>
> 1. As per requirement from client, I made optional *alt* tag in
> *image* and *title* tag in *table* made required(mandatory) in main DTD.
> The problem is the existing publications(topics) in repository getting fail
> which do not have title in table and alt tag in image.
>
> 2. Customer want to add some tags by default in Arbortext editor to
> reduce writers effort by adding tags manually. So I am trying to make these
> changes only for arbortext editor.
>
>
>
> Can you suggest any idea how to resolve without failing existing
> publication?
>
>
>
> Thanks and regards
>
> Roopesh N
>
>
>
> *From:* Lynn Hales [
>
> *Sent:* Wednesday, May 28, 2014 9:53 AM
> *To:* -
> *Subject:* [adepters] - RE: inserting tags with in another tags by
> default/arbortext-Editor
>
>
>
> Hi Developers,
>
>
>
> Thanks you for the mail.
>
>
>
> So only required tag can insert by default. I am looking if there any
> option to insert optional tag by default by changing any arbortext files
> and Without editing original DTD.
>
>
>
> Thanks,
>
>
>
> Roopesh
>
> *From:* Lynn Hales []">mailto:-<->]
>
> *Sent:* Wednesday, May 28, 2014 7:14 PM
> *To:* -
> *Subject:* [adepters] - RE: inserting tags with in another tags by
> default/arbortext-Editor
>
>
>
> Roopesh,
>
>
>
> Yes it is, at least to a degree. In your 'set commands' there is an option
> called 'set addrequiredtags' (help 9181) that will provide pretty much what
> you want.
>
> There are some limits, only 'required' tags are inserted and only if the
> insertion will not cause parsing errors.
>
>
>
> Go to the menu select 'tools|preferences' then click on the 'edit'
> category and check the box to 'insert required elements' then click OK.
>
>
>
> Lynn
>
>
>
> *From:* Roopesh Navath []">mailto:-<->]
>
> *Sent:* Wednesday, May 28, 2014 5:59 AM
> *To:* -
> *Subject:* [adepters] - inserting tags with in another tags by
> default/arbortext-Editor
>
>
>
>
>
> Hi developers,
>
>
>
> I want to insert some tags with in other tags by default in Arbortext
> Editor. Ex: when I insert Table tag , title should insert by default
> without changing optional to required in DTD. Is it possible with DCF
> files or FOSI files?
>
>
>
>
>
> Regards,
>
> Roopesh Navath
>
>
>
>
>

Hi Roopesh,

How about a keymapping that inserts the <title> tag? For example:

map F4 insert_tag title

Authors just press F4 to insert a <title> when desired. Note that authors should be aware that if F4 is pressed when <title> is not in context, an error message will result and the <title> will not be inserted.

Include the kaymapping in a start-up file.Any keystroke or combination of keystrokes can be used. Enter show fullkeymap at the command line to see existing key mappings. Enter show keymap at the command line to display user-defined key mappings.

Good luck!

Suzanne Napoleon
www.FOSIexpert.com
"WYSIWYG is last-century technology!"


Paul is right, this is exactly how we implemented the same change you're looking for, automatically inserting <alt> within <image> you need to create a custom acl function that uses the insert_tag_after callback. The function should test if you're inside an image tag, insert the alt tag, then move the cusor back to within the image tag to then insert the title tag.


Add this in functionto a .acl file in the custom\init folder.

In Reply to Paul Nagai:


Hi Roopesh,

You should look into callbacks generally and the insert_tag_after callback
specifically. This callback will let you test an inserted tag and if it is
found to be a table, you can insert the title. This should not cause
performance issues.


On Wed, May 28, 2014 at 7:36 AM, Roopesh Navath
wrote:

> Hi,
>
>
>
> Thank you for the quick reply.
>
>
>
> I will tell my requirement.
>
>
>
> 1. As per requirement from client, I made optional *alt* tag in
> *image* and *title* tag in *table* made required(mandatory) in main DTD.
> The problem is the existing publications(topics) in repository getting fail
> which do not have title in table and alt tag in image.
>
> 2. Customer want to add some tags by default in Arbortext editor to
> reduce writers effort by adding tags manually. So I am trying to make these
> changes only for arbortext editor.
>
>
>
> Can you suggest any idea how to resolve without failing existing
> publication?
>
>
>
> Thanks and regards
>
> Roopesh N
>
>
>
> *From:* Lynn Hales [mailto:-]
> *Sent:* Wednesday, May 28, 2014 7:56 PM
>
> *To:* -
> *Subject:* [adepters] - RE: inserting tags with in another tags by
> default/arbortext-Editor
>
>
>
> Roopesh,
>
>
>
> No, inserting optional tags can be counterproductive. If you do not want
> it, then you must remove it.
>
>
>
> If you feel you need the tag all the time then consider changing the
> DTD/Schema to make it required.
>
>
>
> Epic is reading the DTD/schema and has no way of knowing what your
> individual requirements are.
>
>
>
> All that aside, you could write an ACL or similar script to insert
> specific tags at a given time. HOWEVER, this would require the script to be
> running continuously and could easily slow your authoring process down as
> it will be a system resource hog.
>
>
>
> One last option is you might be able (and I do not use this feature so I
> am purely guessing), is make an 'alias' tag that has the elements you want
> as required and then possibly the 'set addrequiredtags' would insert the
> elements you want.
>
>
>
>
>
> Lynn
>
>
>
> *From:* Roopesh Navath [
>
> *Sent:* Wednesday, May 28, 2014 9:53 AM
> *To:* -
> *Subject:* [adepters] - RE: inserting tags with in another tags by
> default/arbortext-Editor
>
>
>
> Hi Developers,
>
>
>
> Thanks you for the mail.
>
>
>
> So only required tag can insert by default. I am looking if there any
> option to insert optional tag by default by changing any arbortext files
> and Without editing original DTD.
>
>
>
> Thanks,
>
>
>
> Roopesh
>
> *From:* Lynn Hales [
>
> *Sent:* Wednesday, May 28, 2014 7:14 PM
> *To:* -
> *Subject:* [adepters] - RE: inserting tags with in another tags by
> default/arbortext-Editor
>
>
>
> Roopesh,
>
>
>
> Yes it is, at least to a degree. In your 'set commands' there is an option
> called 'set addrequiredtags' (help 9181) that will provide pretty much what
> you want.
>
> There are some limits, only 'required' tags are inserted and only if the
> insertion will not cause parsing errors.
>
>
>
> Go to the menu select 'tools|preferences' then click on the 'edit'
> category and check the box to 'insert required elements' then click OK.
>
>
>
> Lynn
>
>
>
> *From:* Roopesh Navath [
>
> *Sent:* Wednesday, May 28, 2014 5:59 AM
> *To:* -
> *Subject:* [adepters] - inserting tags with in another tags by
> default/arbortext-Editor
>
>
>
>
>
> Hi developers,
>
>
>
> I want to insert some tags with in other tags by default in Arbortext
> Editor. Ex: when I insert Table tag , title should insert by default
> without changing optional to required in DTD. Is it possible with DCF
> files or FOSI files?
>
>
>
>
>
> Regards,
>
> Roopesh Navath
>
>
>
>
>
Top Tags