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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Burst configuration file, location rule for graphic objects

krussell
1-Newbie

Burst configuration file, location rule for graphic objects

I use an xpath expression in a locrule to store document objects in a variable folder path location. I want to store graphic objects in the same folder as the parent document. But I get an error that says you cannot use xpath when sourcetype=graphic. Is there a way to do this?

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Mike,

I would try the first suggestion before the 2nd. It's much less hassle. I lifted the 1st suggestion from a working bcf we have and replaced your Xpath.

If your graphic element is "image" then I would try...

<locnrule elementname="image" expr="concat(substring(/task/@id,1,1),'/',substring(/task/@id,2,1),'/',substring(/task/@id,3,1),'/',substring(/task/@id,4,2),'/',substring(/task/@id,6,1),'/',substring(/task/@id,1,8))"/>

-Jeff

View solution in original post

7 REPLIES 7

The BCF should just see everything as elements. I'm not sure why it would have a problem.

Can you post your bcf file?

Hi Jeff,

This is Mike Moore. I used my colleague Keith Russell's login before I set up my own account.

Attached are the BCF file and a screen shot of the error caused by the last three locrule elements. The xpath expressions in the first three locrule elements work fine. For example, if the id for the root element in a concept topic (DITA) is "INOTWD01-04", the first locrule element puts the document object in folder INOTWD01 in the following folder path:

I

N

O

TW

D

INOTWD01

In the last three locrule elements, I'm attempting to put any graphics that are usedin the topic in the same folder as the document object. I believe I must use the sourcetype attribute with a value of "graphic", not the elementname attribute to burst graphic objects.

Thanks,

Mike

Hi,

Thanks for sharing your bcf.

I've handled graphics a bit differently in the past. Is there a reason that you are specifying @sourcetype? You could treat graphics like regular elements and that may get around the error.

Example:

<locnrule elementname="graphic" expr="concat(substring(/task/@id,1,1),'/',substring(/task/@id,2,1),'/',substring(/task/@id,3,1),'/',substring(/task/@id,4,2),'/',substring(/task/@id,6,1),'/',substring(/task/@id,1,8))"/>

When you use @sourcetype="graphic", Arbortext is calling the dcf file to see what defines as a graphic. I don't think it is inspecting the surrounding XML at all. It's working at an application/rules level. It makes sense that you cannot use @sourcetype and @expr together.

Alternatively, I've used ACL to get the correct location when using @sourcetype.

Example:

<locnhook sourcetype="graphic" type="acl">

<![CDATA[ dms::set_burst_hook_value(burst_hooks::generate_graphic_path());

]]>

</locnhook>

In this example, generate_graphic_path() is an ACL function that gets the locatin based on the XML. It's a bit more work, but it allows you to use @sourcetype and base the location off of the XML context.

Hope that helps!

-Jeff

Thanks Jeff.

I believe your second approach is what I need to do. After looking at your two suggestions, I realize the distinction is between the element (<image> element in my case) and the graphic file (usually a .png file in my case). It is the graphic file that I'm trying to put in the document directory. If I understand the locrule element correctly, you must use @sourcetype to do this. I may or maynot also need to burst the image element.

I'll be poking around with the generate_graphic_path() function, but if you think I'm wrong about the above, just let me know.

Thanks again,

Mike

Hi Mike,

I would try the first suggestion before the 2nd. It's much less hassle. I lifted the 1st suggestion from a working bcf we have and replaced your Xpath.

If your graphic element is "image" then I would try...

<locnrule elementname="image" expr="concat(substring(/task/@id,1,1),'/',substring(/task/@id,2,1),'/',substring(/task/@id,3,1),'/',substring(/task/@id,4,2),'/',substring(/task/@id,6,1),'/',substring(/task/@id,1,8))"/>

-Jeff

Hi Jeff,

I finally got it. Attached is my latest BCF file. Here's what I found:

The last locnrule element (for the image element) is written like your suggestion. It does put this element object in the document folder. However it does not do anything with the graphic file that the image element points to. The graphic file object would continue to pe put at it's default location at the root of the folder structure. The locnhook element is needed to handle the graphic file. It does put the graphic file object in the document folder. Both the image element object and the graphic file object are initially only in the active workspace. They don't move to the document folder until these objects are checked in.

Thanks for the ideas and the help.

Mike

Glad you got it working!

Top Tags