Re: [Xsltforms-support] hiding/displaying groups
Brought to you by:
alain-couthures
From: Jens Ø. P. <oe...@gm...> - 2012-07-11 08:43:31
|
Hello Michael, Thank you for laying out the law! Both your rewritings work fine. I wonder which one is the fastest? Regards, Jens On Jul 10, 2012, at 9:55 PM, C. M. Sperberg-McQueen wrote: > > On Jul 10, 2012, at 5:01 AM, Alain Couthures wrote: > >> Hello Jens, >>> I have groups for hiding/displaying a set of buttons for inserting missing elements and attributes. They are at times monstrously long, such as, >>> >>> <xf:group class="show-hide" ref=".[not(@altRepGroup)] | .[not(@authority)] | .[not(@authorityURI)] | .[not(@displayLabel)] | .[not(@ID)] | .[not(@lang)] | .[not(@nameTitleGroup)] | .[not(mods:nonSort)] | .[not(mods:partName)] | .[not(mods:partNumber)] | .[not(@script)] | .[not(mods:subTitle)] | .[not(@supplied)] | .[not(mods:title)] | .[not(@transliteration)] | .[not(@type)] | .[not(@usage)] | .[not(@valueURI)] | .[not(@xml:lang)] | .[not(@xlink:href)]"> >> First, I would try to minimize such expressions like this, if there is >> one char that should not appear in values: >> .[not(contains(concat('~',@altRepGroup,'~',@authority,'~',@authorityURI,'~',@displayLabel,'~',@ID,'~',@lang,'~',@nameTitleGroup,'~',.....,'~'),'~~'))] > > For the case where we don't have any guarantees about the values > (so concatenating with '~' or any other magic character is not safe), I > wonder (just thinking out loud here) if applying DeMorgan's Law to > produce a simpler expression would help: > > ref=".[not(@altRepGroup and @authority and @authorityURI and ... > ... and @xlink:href)]" > <xf:group class="show-hide" ref=".[not(mods:partName and mods:partNumber and @script and mods:subTitle and @supplied and mods:title and @transliteration and @type and @usage and @valueURI and @xml:lang and @xlink:href)]"> > Or even (if your list is all the attributes that are possible, which is > alas probably not the case) > > ref=".[count(@*) < 20]" > > Not tested. <xf:group class="show-hide" ref=".[count(@*) < 8 or count(*) < 5]"> > > Michael > > -- > **************************************************************** > * C. M. Sperberg-McQueen, Black Mesa Technologies LLC > * http://www.blackmesatech.com > * http://cmsmcq.com/mib > * http://balisage.net > **************************************************************** > > > > |