FW: [Xsltforms-support] does the most recently selected toggle have acharacteristic property?


-----Original Message-----
From: C. M. Sperberg-McQueen [mailto:cmsmcq@blackmesatech.com] 
Sent: Thursday, September 23, 2010 1:57 PM
To: xsltforms-support@lists.sourceforge.net
Subject: [Xsltforms-support] does the most recently selected toggle have
acharacteristic property?

The most recently selected control in a form has, if I understand
things correctly, the property of being in-focus, which means in
XSLTForms that it has the xforms-focus class.  So it's easy to style a
control one way if it's the current focus and a different way the rest
of the time.  So far, so good.

I've been looking at the example of a tabbed interface originally done
by Kurt Cagle and currently on the Web at


and as a sort of exercise I decided I would unroll the xf:repeat which
currently generates the tabs at the top of the page, and uses the
::repeat-index (the 'xforms-repeat-item-selected' class, in XSLTForms)
to make the currently selected tab be white, and the others light

For a set of tabs all of which have static content, the xforms-focus
property can be used to color the current tab white, as illlustrated
by the 'Encoding description', 'Profile description', and 'Revision
history' tabs in the toy example at


This is not quite satisfactory, because it's possible for the toggle
area for the currently selected case to lose focus (e.g.  if the user
presses the TAB key), and for other toggles to gain focus without
switching the content.  But the really fatal problem for me at the
moment is when there are input controls on the currently selected
pane, the user cannot use them without the toggle control losing focus
and turning gray.

So: two questions.

(1) is there a property of some kind that distinguishes a toggle which
is bound to the currently selected case from a toggle which is bound
to a non-selected case?  Or is there some other way to distinguish
between the two in a way that allows the background color of the
toggles to change each time the selected case changes, and not

(2) What other ways are there to address this user interface problem?

- I could just move the four triggers into the cases (so there are
four copies of each trigger), and give a special class or ID to the
one that needs to be shown as active.  This will work, but it seems to
be cracking a walnut with a steam engine, and the redundancy is sure
to bite me sooner, not later.

- Each trigger + pane pair can be given a different background color,
along the lines of Steven Pemberton's example at


- Instead of moving the triggers into the case elements, and providing
four copies of each, physically separated from each other to maximize
the chance of forgetting to keep them in synch, I could make two
copies of each, with class="currently-active" and
class="currently-inactive", and bind them to nodes that become
relevant or non-relevant as the state of the interface changes, using
the methods outlined in the sections on model-based switching and
master/detail views in Steven Pemberton's tutorial at


This is a smaller steam engine than the first one, but still feels
disproportionate to the immediate task.

- The use of xf:repeat to iterate over a set of elements in the
instance is looking better and better, because ::repeat-index does
just what I'm looking for: it changes just when another item in the
same repeat group is selected.

Are there other methods known to readers of this list that you would
be willing to share?

Thank you!

Michael Sperberg-McQueen

* C. M. Sperberg-McQueen, Black Mesa Technologies LLC
* http://www.blackmesatech.com
* http://cmsmcq.com/mib
* http://balisage.net

Nokia and AT&T present the 2010 Calling All Innovators-North America
Create new apps & games for the Nokia N8 for consumers in  U.S. and
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store

Xsltforms-support mailing list

Received on Thursday, 23 September 2010 20:57:06 UTC