Skip to main content
Known Participant
November 12, 2015
Answered

Filter By Attribute filtering incorrect elements

  • November 12, 2015
  • 1 reply
  • 1507 views

Hi all,

I've been having this issue using Filter By Attribute, and I'm not sure if it's because I'm using the tool incorrectly or simply a FrameMaker bug (but I suspect the former).

Basically, I import an XML document into FM that looks something like this:

<root>

     <elem1 />

     <elem2 attr="true" />

     <elem3 attr="false" />

     <elem4 attr="true" />

</root>

And then I use Filter By Attribute to apply a condition (let's call it "Changed") to all the elements that have attr="true" using the expression: (attr="true"), and another condition ("Unchanged") to those with attr="false" using the expression: (attr="false")

However, the results I get are exactly the opposite! (attr="true") applies the "Changed" condition to all those elements that have the attr="false", and (attr="false") applies the "Unchanged" condition to those with attr="true".

If anyone could provide some insight on why this is happening, I would be very grateful.

Thanks,

Carl

This topic has been closed for replies.
Correct answer Lynne A. Price

Carl,

   You are not the only user who finds filter by attribute to be counterintuitive. The underlying model seems to assume you want to keep content matching an expression and filter out content that does not match. However, the only elements that are tested to see whether or not they match are those with values, explicit or default, for all the attributes mentioned in the expression.

   Thus, filtered text seems to consist of elements that have values, explicit or defaulted, for all the attributes that appear in the applied expression but do NOT match that expression. Hence, if you want to apply condition Changed to elements that set attr to "true", use the expression NOT(attr="true"); to apply condition Unchanged, use the expression NOT(attr="false").To apply one or the other condition to every element that sets this attribute, apply both expressions.

  If no default value for attr is assigned in FM (regardless of any default in XML), neither expression will apply a condition to an element that does not set the attribute. If there is a default value, the default will determine how elements that do not set the attribute are processed.

  If you change the attribute setting, reapply the expressions, checking the Remove if Previously Applied box.

     --Lynne

1 reply

Lynne A. PriceCorrect answer
Inspiring
November 12, 2015

Carl,

   You are not the only user who finds filter by attribute to be counterintuitive. The underlying model seems to assume you want to keep content matching an expression and filter out content that does not match. However, the only elements that are tested to see whether or not they match are those with values, explicit or default, for all the attributes mentioned in the expression.

   Thus, filtered text seems to consist of elements that have values, explicit or defaulted, for all the attributes that appear in the applied expression but do NOT match that expression. Hence, if you want to apply condition Changed to elements that set attr to "true", use the expression NOT(attr="true"); to apply condition Unchanged, use the expression NOT(attr="false").To apply one or the other condition to every element that sets this attribute, apply both expressions.

  If no default value for attr is assigned in FM (regardless of any default in XML), neither expression will apply a condition to an element that does not set the attribute. If there is a default value, the default will determine how elements that do not set the attribute are processed.

  If you change the attribute setting, reapply the expressions, checking the Remove if Previously Applied box.

     --Lynne

Known Participant
November 12, 2015

Thank you Lynne!

Legend
November 13, 2015

Carl,

Just a suggestion... if you would like to see structure-based condition management done right (IMHO), you could try out my AXCM plugin. It is free and always will be:

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

I was originally excited when the filter-by-attribute feature was announced, because I thought maybe I could stop maintaining this plugin. No such luck, though. The Adobe implementation is really half-baked and I don't see how it could really be used in a high-demand, production environment.

Russ