Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
Hi,
I am creating a print fosi for our tech authors to review content in a pdf form.
I have an element that requires a 3-digit numerical value per its DTD (which I can't alter) and am capturing its value with a savetext in order to output it later in the instance. That was fine, but now my authors want to see that number output without its leading zeros when they print a review copy if its value is less than 100, i.e., "98" not "098". Is there a way to strip those leading zeros out using FOSI?
Thanks, KM
Hi again and thanks for the suggestions.
Unfortunately, I have never delved into ACL and I think I may need a wee more help. I looked up the substr function in the Arbortext Helpcenter reference, but that expects me to know where to chop the string and I can't know that since there could be either one or two leading zeros in the string. I think that the sub function is probably the right one since it says it allows regular expressions as Lynn suggested, but I confess I have no idea how to put such a script together and feed the result back to my FOSI.
So I'm guessing I need to learn ACL. Is there some place that shows you practical examples of how to put together an ACL script? I didn't find too many helpful examples in Helpcenter, or maybe I just don't know how to search for them well. Any good books on it?
KM
Adrian,
First of all, thanks. I did give your acl script a try, but it does not work for my situation.
It works if the text content is in the element itself, but my content is actually the value of an attribute that I am capturing with a savetext in my FOSI. I need to strip the zeros out of that saved string to a new value before outputting it later on the page.
So I am going to play with this a bit more I guess.
Thanks again for your input. I followed your instructions - I updated my acl script as you suggested and added an attribute rule (to call the script and do the savetext) to the e-i-c for the element that has the attribute with the value I'm trying to modify - but I still have no success.
I now get no value at all when I output the text string later in the page. So I guess I'm still doing something wrong. I suspect I'm just not getting the value of the attribute into the function properly to begin with. Is there a way to check the function at the command line like you suggested in the previous one?
Thank you for your help again. I'm getting closer at least. I confirmed that the function is doing its thing correctly by opening my test file and sourcing the script (zero.acl - below) and using the eval command. It pops up a box with the truncated number. So that's good.
function stripfigno(wid, oid) {
local x, i, val
$x = oid_attr(oid, 'figureNumber')
$i = match($x, '[^0]')
$val = substr($x, $i)
return $val
}
There is a problem with the savetext, though, because when I put a usetext in the element with the attribute rule as you suggested all I get for output is the random text - ** and then nothing. My attribute rule is:
<att>
<fillval attname="stripfigno" attloc="system-func" fillcat="savetext" fillchar="conrule">
<charsubset><savetext conrule="ipdfigno.txt"></charsubset>
</att>
When I open my file that I am using to test I am also getting this warning:
"Att match: no user defined function named "stripfigno". This is a FOSI coding or application ACL error."
As I said in the beginning, I'm not very familar with ACL so is there something else I need to do in the fosi so it knows how/where to find the function?
Right now, I have the script in my custom\scripts directory as you suggested, but ultimately I would like to be able to put multiple functions into an instance.acl file and keep it in the central custom folder with the dtd and fosi rather than copy scripts to all the writers C: drives. So that's where I'm trying to head.
First of all I want to thank everyone for their help and patience. I've just had a chance to fiddle with this again today and I found that if I put the acl script in the custom\editinit directory on my C: drive, it works when I call the function in the fosi. (after fixing the savetext rule!).
It does not work if it is in either the \custom\scripts or custom\init directories, although from what I read in the documentation, it looks like editor should search the init directory before editinit ??
I don't want to have to copy it to all the writers' PCs, so I created a documenttype.acl file in the dtd directory (which is in a network location) and put this function in it and it seems to work from there, although I cannot get it to work if I try to use an instance.acl file instead.. I have to admit, I'm not really sure what the difference is.. or which is better to use. But it's working! Thank you all so much! Now I'm hoping I can write some functions on my own to fix a few other things.