InfoPath allows you, the template developer, to manually modify templates to include XSL features that are not directly supported from within the InfoPath designer. These are called Preserve Code Blocks.
To create a Preserve Code Block, simply change the mode attribute for both the xsl:template and the xsl:apply-templates to have a value of xd:preserve.
One known issue is that on roundtripping your template in the designer, InfoPath will move the closing input tag to immediately after the opening tag.
For example:
<input class="xdBehavior_Boolean" title="" type="radio" name="{generate-id(my:field1)}" xd:binding="my:field1" xd:boundProp="xd:value" xd:onValue="1" tabIndex="0" xd:xctname="OptionButton" xd:CtrlId="CTRL1"> <xsl:attribute name="xd:value"> <xsl:value-of select="my:field1"/> </xsl:attribute> <xsl:if test="my:field1="1""> <xsl:attribute name="CHECKED">CHECKED</xsl:attribute> </xsl:if> </input> Radio Button 1 |
Will be changed to:
<input class="xdBehavior_Boolean" title="" type="radio" name="{generate-id(my:field1)}" xd:binding="my:field1" xd:boundProp="xd:value" xd:onValue="1" tabIndex="0" xd:xctname="OptionButton" xd:CtrlId="CTRL1"></input> <xsl:attribute name="xd:value"> <xsl:value-of select="my:field1"/> </xsl:attribute> <xsl:if test="my:field1="1""> <xsl:attribute name="CHECKED">CHECKED</xsl:attribute> </xsl:if> Radio Button 1 |
Because of this change, the xsl:attributes will no longer be applied, as they should, to the opening tag. This effectively disables the radio buttons.
To resolve this issue, you must convert your input tag to an xsl:element, as shown here:
<xsl:element name="input"> <xsl:attribute name="class"> <xsl:value-of select="xdBehavior_Boolean"/> </xsl:attribute> <xsl:attribute name="type"> <xsl:value-of select="radio" /> </xsl:attribute> <xsl:attribute name="name"> <xsl:value-of select="{generate-id(my:field1)}"/> </xsl:attribute> <xsl:attribute name="xd:binding"> <xsl:value-of select="my:field1"/> </xsl:attribute> <xsl:attribute name="xd:boundProp". <xsl:value-of select="xd:value"/> </xsl:attribute> <xsl:attribute name="xd:onValue"> <xsl:value-of select="1"/> </xsl:attribute> <xsl:attribute name="tabIndex"> <xsl:value-of select="0"/> </xsl:attribute> <xsl:attribute name="xd:xctname"> <xsl:value-of select="OptionButton"/> </xsl:attribute> <xsl:attribute name="xd:CtrlId"> <xsl:value-of select="CTRL1"/> </xsl:attribute> <xsl:attribute name="xd:value"> <xsl:value-of select="my:field1"/> </xsl:attribute> <xsl:if test="my:field1="1""> <xsl:attribute name="CHECKED">CHECKED</xsl:attribute> </xsl:if> </xsl:element> Radio Button 1 |
©2005 Greg Collins. All rights reserved. Licensed to Autonomy Systems, LLC for display on InfoPathDev.com.