Skip to main content
Known Participant
May 27, 2015
Question

How to apply a conditional tag to ALL elements in a structured document?

  • May 27, 2015
  • 2 replies
  • 1162 views

Hey all, I'm wondering if there is an easy way to apply one conditional tag to all occurrences of a single element in a structured framemaker file?

I'm reading in data from an XML file and formatting it according to its tags, and would like to make all the text between the <X> ... </X> tags formatted

with a certain conditional tag. There are many instances of this <X> ... </X> element, and I'd like to format all of them.

I know how to do this manually, but there are hundred of these tags and it would take far too long.

I've gone into the XML and noticed that framemaker adds some formatting elements in there, but does anyone know an easier way than to write a script

that manually places this conditional formatting stuff into the XML document?

Any help is appreciated. Thanks!

This topic has been closed for replies.

2 replies

Legend
May 28, 2015

Carlm,

I agree with Scott, that mixing native conditional tags with structural markup is not such a great idea. While FrameSLT could do the job, I would be more apt to suggest an AXCM workflow instead:

AXCM Plugin - West Street Consulting

It allows conditional formatting, show/hide, etc. based on structural markup directly. If you go through the tutorials, I think you should get the idea quickly. It can evaluate any type of markup for conditional evaluation, including attribute values, element names, element content, and hierarchy.

Disclaimer - I am the author of both plugins. AXCM is completely free, but FrameSLT is not. I am also a technical writer who leans heavily on their respective functionalities, hence the inspiration for their births.

Russ

Known Participant
May 28, 2015

Hi Russ,

Thanks for the info. I'll have a look into that plugin, hopefully it will do the trick!

ScottPrentice
Inspiring
May 27, 2015

You should check out FrameSLT from West Street Consulting (worth its weight in gold) ..

     http://www.weststreetconsulting.com/WSC_FrameSLT.htm

However, I must point out that in general it's a really bad idea (IMHO) to use conditional tagging in XML files. You should apply formatting through EDD context rules, and perform filtering via attributes on elements. This will eventually come back to bite you and will likely cause FM to crash.

Cheers,

...scott

Known Participant
May 27, 2015

Hey Scott,

Thanks for the advice! I'm pretty new to framemaker so I really have no idea when it comes to best practices. I've created an EDD to map the XML elements with their paragraph formats, but will the element attribute formatting approach achieve the same effect as the conditional formatting (specifically the show/hide feature)?

ScottPrentice
Inspiring
May 27, 2015

FrameMaker has a Filter By Attribute command, so in theory, you should be able to do the same filtering (hide/show) using attributes as you can with conditions. In DITA there's a status attribute on every element, with possible values of new, changed, deleted, and unchanged. If you used this model you could set up the EDD so it applied change bars for all elements that have status set to "new" or "changed". You could also set up the Filter By Attribute command to hide content that's got status set to "deleted".

You would need to set up some process for clearing the status attribute when you move on to the next revision. That can be done through XSLT or ExtendScript scripting.

If you were using DITA, I'd suggest that you take a look at a tool that I create called DITA-FMx, which provides features for automatically assigning values to the status attribute as well as clearing the value. (It doesn't provide the EDD modifications to apply change bars, but that can be done.)

Cheers,

...scott