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

Relative path when inserting an image in Arbortext Editor

SOLVED
pierat
1-Newbie

Relative path when inserting an image in Arbortext Editor

Suppose my xml document is at c:\temp\xml

If I insert a graphic which is stored at the same level of my XML document, the result is :

<inlinegraphic fileref="graphic6.png"/>

If the graphic is in an image directory at the same level, it becomes :

<inlinegraphic fileref="images/graphic6.png"/>

Now, if I want to reference an image that is one level down in my tree structure (temp/shared), A/E switch to absolute path and the result is ;

<inlinegraphic fileref="c:\temp\shared\graphic6.png"/>

So my question : is is possible to hava a relative path (../shared/graphic6.png) instead of an absolute.

Any idea is welcome, Pierat

1 ACCEPTED SOLUTION

Accepted Solutions

A little ACL can help you here. I use the insert_tag_after callback to modify the attribute value for the system path when authors insert an image element.

doc_add_callback(0,'insert_tag_after','img_pathfix')

function img_pathfix (doc,tagname,op)
{
if(op ==1)
{
if(tagname == 'image')
{
#response("found an image")
o = oid_attr(oid_caret(),'system-path')
oid_modify_attr(oid_caret(),'system-path',universal_file_name(o))
}
}
}

I use this function to change mapped network drive paths to UNC paths, but after capturing the attribute's value with o=oid_attr(oid,attname), you should be able to modify that value any way you feel necessary and use the oid_modify_attr(oid,attname,val) to "fix" the value.

There is also an insert_tag callback, but it triggers before the markup is inserted, so it's ineffective for modifying an attribute since the element hasn't been inserted yet.

Hope this helps...

-Jason A. Buss

View solution in original post

1 REPLY 1

A little ACL can help you here. I use the insert_tag_after callback to modify the attribute value for the system path when authors insert an image element.

doc_add_callback(0,'insert_tag_after','img_pathfix')

function img_pathfix (doc,tagname,op)
{
if(op ==1)
{
if(tagname == 'image')
{
#response("found an image")
o = oid_attr(oid_caret(),'system-path')
oid_modify_attr(oid_caret(),'system-path',universal_file_name(o))
}
}
}

I use this function to change mapped network drive paths to UNC paths, but after capturing the attribute's value with o=oid_attr(oid,attname), you should be able to modify that value any way you feel necessary and use the oid_modify_attr(oid,attname,val) to "fix" the value.

There is also an insert_tag callback, but it triggers before the markup is inserted, so it's ineffective for modifying an attribute since the element hasn't been inserted yet.

Hope this helps...

-Jason A. Buss

View solution in original post

Announcements