Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
We keep getting an error for a specific attribute. Invalid value "" for attribute "monographstatus" Even though I have set a default value to "none" in the DTD, the editor does not actually insert the attribute in context until you manuall go into the Modify Attribute box and set the value to none. Only then will it actually show up in the editor.
I was wondering how can you can automatically set the value (acl) of the attribute if it's blank
I don't know how do to acl but it would be something like this:
IF attribute "monographstatus="" then value=none
IF attribute "monographstatus="anything else" then don't do anything.
Make sense?
OR - is there a way for the Editor to set the default values in the editor.
Hope this makes sense. Any help is appreciated.
Thanks, Darquise.
Darquise
You can use the Find -> Replace Attribute (make sure Tools -> Preferences -> Window -> Full Menus is enabled) for this.
To search for an empty string, enter a space and then press the BACKSPACE to delete it in the "Value" field,
Also you'd need to enable Tools -> Preferences -> Edit -> Allow Empty String Attribute Values
As for the ACL... You can use something like the code below. I implied that the attribute relates to a particular element, but you can modify the script so it searches all elements.
#substitute <p> with the required element
find -m '<p>' -nowrapscan
$oid=oid_caret()
$oid=selected_element()
#checks if there is a @monographstatus attribute in the current element
if(oid_xpath_boolean($oid, '@monographstatus') ){
#checks if the @monographstatus attribute's value is ''
if(current_tag_attr_value(monographstatus)==''){
modify_attr(monographstatus, 'none')
} else {
response('no_null')
}
} else {
response('no_tag')
}