Page 1 of 1

Changing attribute in CSS

Posted: Wed Aug 08, 2018 5:33 pm
by gpmn
Hi

I am trying to change the @id attribute of <resourceid> element to @appid. That is I want to store the Resource ID value in the @appid attribute instead of @id attribute.

from

Code: Select all

<resourceid id="NA"/> 
to

Code: Select all

 <resourceid appid="NA"/> 
If I open the topic where we have a resourceid element with @id and try to insert some values in it. In Author mode I can see only @appid value but in text mode it is showing @id and @appid values.

Code: Select all

  <resourceid id="NA" appid="NA"/>
Is there any way to replace the attribute name ?

Best Regards
Girish P

Re: Changing attribute in CSS

Posted: Thu Aug 09, 2018 8:04 am
by Radu
Dear Girish,

What version of Oxygen are you using? I tried to open a DITA topic using Oxygen 20.1 in the Author visual editing mode and for the "resourceid" element both the id and appid attributes are presented as editable in text fields.
Anyway in the Oxygen main menu "Tools->XML Refactoring" you have a "Rename attribute" action which can be applied either on one file or on a multiple set of files.

Regards,
Radu

Re: Changing attribute in CSS

Posted: Thu Aug 09, 2018 8:09 am
by gpmn
Hi Radu,

Thanks for the reply.

I am using oXygen 18.1. Is there any way to change this using CSS only ?

Best Regards
Girish

Re: Changing attribute in CSS

Posted: Thu Aug 09, 2018 11:20 am
by Radu
Hi Girish,

You can open this CSS file:

OXYGEN_INSTALL_DIR\frameworks\dita\css\core\-topic-metadata-prolog.css

and it has two selectors like:

Code: Select all

*[class~="topic/resourceid"][id]:before {
-oxy-append-content: oxy_textfield(columns, 30, edit, "@id");
}
*[class~="topic/resourceid"][appid]:before{
-oxy-append-content: oxy_label(text, " appId: ", width, 5ex) oxy_textfield(columns, 12, edit, "@appid");
}
which can be replaced with:

Code: Select all

*[class~="topic/resourceid"][id]:before {
-oxy-append-content: oxy_label(text, " ID: ", width, 5ex) oxy_textfield(columns, 30, edit, "@id");
}
*[class~="topic/resourceid"]:before{
-oxy-append-content: oxy_label(text, " appId: ", width, 5ex) oxy_textfield(columns, 12, edit, "@appid");
}
You may need to give full access rights to editing the CSS file for the current user name if you cannot save to it.

Regards,
Radu