Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Hello,
We are using Arbortext Editor 5.4 for authoring some newsletter in SGML.
My editors need to know the number of characters in their title.
I know we can count the number of words... but it's not relevant for them.
So I'm guessing if it's possible to count the numbers of chars in a tag with a macro or something else...
Thanks for your help.
Regards.
Solved! Go to Solution.
A simple approach would be something like this (typed in the Arbortext command window):
response(length(oid_xpath_string(oid_caret(),".")))
It gets a little more complicated if there can be embedded tags inside the element you're interested in. This particular version will string together all text nodes inside the current tag (where the caret is), ignoring nested markup.
If this works for you, you could hook it up to a menu item using menu_add to make it easy for your authors to use.
I have a question here. Do they want to know the input characters (not counting tags) or the ouput characters printed on the documents.We have a lot of generated text by the FOSI which displays on the document (like Table of contents, company name and address, Figrure name in the text for example Figure 9. The gear shift.
What values do they wnat, what is the purpose fo the count.
Hi Ray--
I'm not the OP, so I can't address your question about this use case directly, but they seemed to be satisfied with my suggestion, so I assume they aren't trying to include generated text or other markup artifacts.
If someone did have a use case where they needed to include gentext, they'd have to smarten up the script a bit, probably by walking the OID tree for the selected OID and using a combination of oid_gentext() and oid_content() in lieu of the simple oid_xpath_string() expression.
--Clay
A simple approach would be something like this (typed in the Arbortext command window):
response(length(oid_xpath_string(oid_caret(),".")))
It gets a little more complicated if there can be embedded tags inside the element you're interested in. This particular version will string together all text nodes inside the current tag (where the caret is), ignoring nested markup.
If this works for you, you could hook it up to a menu item using menu_add to make it easy for your authors to use.
Thank you Clay
I will try it asap
Regards.
Benjamin
Hello Clay,
To keep you in touch, your code is working great.
Thank you very much.
Benjamin
Hi Benjamin--
Great, I'm glad to hear it's working for you. In that case, would you mind taking a momemt to mark my reply as "Answer"? Thanks.
--Clay
done !
Thanks again.
Benjamin