I am trying to supply label for the tab (tabs widget) from the form instance and it seems to be ignoring all xforms tags when I have them inside the widget:label tag.
(Attached is a sample form that demonstrates that) Syntax error or a bug? :-) Thanks. testSimple.xhtml |
hi mangvlad,
> I am trying to supply label for the tab (tabs widget) from the form instance > and it seems to be ignoring all xforms tags when I have them inside the > widget:label tag. that's true - the tab widget gets "preprocessed" by a xslt stylesheet, the tab label is created acording to the following rule (omitted the case when the tab is active): <!-- Case where this tab is inactive --> <xforms:case id="{$tab-id}-inactive"> <xhtml:div class="widget-tab-inactive"> <xforms:trigger appearance="xxforms:link" id="{@id}-trigger"> <xsl:choose> <xsl:when test="widget:label/@ref"> <xforms:label ref="{widget:label/@ref}"/> </xsl:when> <xsl:otherwise> <xforms:label> <xsl:value-of select="widget:label"/> </xforms:label> </xsl:otherwise> </xsl:choose> <xforms:action ev:event="DOMActivate"> <xforms:toggle case="{$tab-id}"/> <xforms:toggle case="{$tab-id}-active"/> <xsl:for-each select="$tabs[@id != $tab-id]"> <xforms:toggle case="{@id}-inactive"/> </xsl:for-each> </xforms:action> </xforms:trigger> </xhtml:div> </xforms:case> So, with a nested xforms:output inside the widget:label and without a @ref attribute, since the xforms:output isn't processed yet, there's no textual value that could be selected by xsl:value-of. Instead, adding a @ref attribute to the xforms:widget lets the XSLT use the referenced element value: <widget:tabs width="100%" align="center"> <widget:tab id="tab1"> <widget:label ref="/tabs/tab1" /> <xhtml:p>foo</xhtml:p> </widget:tab> <widget:tab id="tab2"> <widget:label ref="/tabs/tab2" /> <xhtml:p>bar</xhtml:p> </widget:tab> <widget:tab id="tab3"> <widget:label ref="/tabs/tab3" /> <!--Just to show that my XPath is correct here, let me display it--> <xforms:output ref="/tabs/tab3" /> </widget:tab> </widget:tabs> HTH florian -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Thank you! I got it.
I have tried to user @ref before but it did not work for me and the reason is that my labels for the tabs are coming from a different model and passing model id as an attribute of the label does not work. I am not sure how easy would it be to change the XSLT to pass model attribute down, but for now I switched to use xxforms:instance(), instead of using instance() function.
|
Free forum by Nabble | Edit this page |