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

Supressing file extensions on external references.


Supressing file extensions on external references.

Good Afternoon Everyone,

I am hoping someone can help me. We are working with a document that
will reference external documents from various formats, i.e. .doc, .pdf,
or .txt for example. I want to generate the title of the document using
xref, but not the file extension. The problem is it could be any or all
of the aforementioned extensions. I have read the "filtering" and
"regular expressions" subjects in the help, and it seems as if there is
a way to do it, I just cant quite figure out how. Any suggestions?

Sindy Young
AWACS Tools and Technology Team,
(253) 773-5811
Kent, WA 98032


Using a regular expression string should be relatively easy to get the
file name and then truncate the file extension.

This is a snippet of code that I used some time back (note the SGM). I am
fairly sure you can adapt it to your needs.

#this takes the makes the system variable a local variable so I can
truncate it.

#this truncates the .sgm extension from the file name so I have only the
filename itself.

If you make the 'match' an "or" expression for the extensions you have
this should work. The match function on line help is help 602. The chop
function is help 673.

In the regular expression in the 'match', I am checking to see if the
value of the variable "idname" is an SGML file. The reg ex of ".*" gives
me any characters up to the dot extension, the "\." and the file name must
end in "sgm".

If you really don't care about the file extension, then this might work
(my usual caveat emptor here, I have not tested this permutation).
chop(idname, 4)

The 'chop' will truncate the last four characters (the DOT and the

This works for WIndoze and three letter file extensions. Something like a
JPEG extension will leave you with the DOT in your file name.


basename() should do the trick. See help 96.


Now that doesn't help when you get paid by the line. So much for
verbosity. 😄

And that command was even there when I wrote my code (or at least last
updated it). I still have a copy of an old ADEPT help file (don't ask
why, I'm a pack rat OK). Probably one of the last help files that was not
a Windoze help file. Some indecipherable code to begin with and then the
actual help text in Dorcbook SGML (<sect1 label="function" basename&quot;=" <br="/>id="help96">). I think this may have been the Adept 9 help file.but I am
not sure. As I recall Adept 8 or 9 came out with an incomplete help file.
Something like the last 15% got truncated and Arbortext had to issue a
patch with the last of the help.


I like to go every other with these 🙂 1 line then 100 then back to 1
(or 2 if I'm feeling a little woozy / under-caffeinated).