[Xsltforms-support] Fwd: xf:setindex support
Brought to you by:
alain-couthures
From: Stephen C. <ste...@gm...> - 2011-11-08 22:46:03
|
Hi All, I'm trying to make use of setindex on a repeat to change a selected 'tab', but setindex is not being triggered. Maybe there is a better approach but I do like this method so far. Here is a test case: <?xml-stylesheet href="xsltforms-beta3/xsltforms/xsltforms.xsl" type="text/xsl"?> <?xsltforms-options debug="yes"?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf=" http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xs=" http://www.w3.org/2001/XMLSchema"> <head> <style type="text/css"> div.annotation{ overflow:auto; padding:1em; } div.annotation > span.xforms-control{ display:block; } div.annotation label.xforms-label{ display:inline-block; width:100px; } div#select_element_detail_node, div#select_element_detail_node div{ display:inline; color:black; } </style> <style> @namespace xf url("http://www.w3.org/2002/xforms"); /* all the attributes of each tab, except the background color */ .horiz_tab_menu xf|trigger { border-left: black solid 1px; border-top: black solid 1px; border-right: black solid 1px; border-bottom: 0px; font-weight: bold; font-family: Helvetica, sans-serif; font-size: .9em; margin-right: 5px; padding: 3px; /* the following only works under FireFox */ /*-moz-border-radius: .5em .5em 0em 0em;*/ border-radius-topright: .5em; border-radius-topleft: .5em; } div.horiz_tab_menu div{ display: inline; } div.horiz_tab_menu a{ text-decoration: none; color: black; } div.horiz_tab_menu div.xforms-repeat-item-selected span.tab_title{ padding: 0.2em; font-size: 1.2em; } /* the attributes of each div inside of a case */ xf|switch xf|case div { border-top: solid black 0px; /*border-left: solid black 1px; border-right: solid black 1px; border-bottom: solid black 1px;*/ } </style> <xf:model id="model1"> <xf:instance id="annotation_editor_tabs"> <dummy xmlns=""> <tab title="super tab 1" case="element_annotation"> <tab title="Title and Description" case="element_annotation_case_1" /> <tab title="Constraints" case="element_annotation_case_2" /> <tab title="Rendering" case="element_annotation_case_3" /> </tab> <tab title="super tab 2" case="element_details_annotation"> <tab title="Title and Description" case="element_details_annotation_case_1" /> <tab title="Constraints" case="element_details_annotation_case_2" /> <tab title="Rendering" case="element_details_annotation_case_3" /> </tab> </dummy> </xf:instance> </xf:model> </head> <body> <div class="horiz_tab_menu"> <xf:repeat nodeset="instance('annotation_editor_tabs')/*" id="detail_tabs_level_1"> <xf:trigger appearance="minimal"> <xf:label> <xf:output class="tab_title" ref="@title" /> </xf:label> <xf:toggle ev:event="DOMActivate"> <xf:case value="@case" /> </xf:toggle> </xf:trigger> </xf:repeat> </div> <xf:switch> <xf:case id="element_annotation"> <div class="horiz_tab_menu"> <xf:repeat nodeset="instance('annotation_editor_tabs')/*[1]/tab" id="detail_tabs_level_2"> <xf:trigger appearance="minimal"> <xf:label> <xf:output class="tab_title" ref="@title" /> </xf:label> <xf:toggle ev:event="DOMActivate"> <xf:case value="@case" /> </xf:toggle> </xf:trigger> </xf:repeat> </div> <div> <xf:switch> <xf:case id="element_annotation_case_1" selected="true"> <div class="annotation"> tab 1-1 </div> </xf:case> <xf:case id="element_annotation_case_2"> <div class="annotation"> tab 2-1 </div> </xf:case> <xf:case id="element_annotation_case_3"> <div class="annotation"> tab 3-1 </div> </xf:case> </xf:switch> </div> </xf:case> <xf:case id="element_details_annotation"> <div class="horiz_tab_menu"> <xf:repeat nodeset="instance('annotation_editor_tabs')/*[2]/tab"> <xf:trigger appearance="minimal"> <xf:label> <xf:output class="tab_title" ref="@title" /> </xf:label> <xf:toggle ev:event="DOMActivate"> <xf:case value="@case" /> </xf:toggle> </xf:trigger> </xf:repeat> </div> <div> <xf:switch> <xf:case id="element_details_annotation_case_1" selected="true"> <div class="annotation"> tab 1-2 </div> </xf:case> <xf:case id="element_details_annotation_case_2"> <div class="annotation"> tab 2-2 </div> </xf:case> <xf:case id="element_details_annotation_case_3"> <div class="annotation"> tab 3-2 </div> </xf:case> </xf:switch> </div> </xf:case> </xf:switch> <xf:trigger> <xf:label>select super tab 1</xf:label> <xf:setindex ev:event="DOMActivate" repeat="detail_tabs_level_1" index="1"/> </xf:trigger> <xf:trigger> <xf:label>select super tab 2</xf:label> <xf:setindex ev:event="DOMActivate" repeat="detail_tabs_level_1" index="2"/> </xf:trigger> </body> </html> |