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
December 14, 2015

Russ -- BTW, I did get the menu to show up, but I had to put the AXCM plugin line as the last line under the API Clients list in maker.ini. Previously, we had Framescript as the last item. 

Anyone know why the order matters?


Hi Shelley,

I don't have any explanation for that behavior. I don't have FrameScript, so I can't test it out. I think the best I can say is that I'm glad you found a solution and I hope it keeps working

Your post motivated me to finally post FM2015 builds for all the plugins. I don't know if it will make any difference in your case but you can get a FM2015 build for AXCM now. Functionally, you shouldn't notice much change.

Russ