2 Radio btn with one Submit btn, convert to Two Buttons

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ismailc
    New Member
    • Sep 2006
    • 200

    2 Radio btn with one Submit btn, convert to Two Buttons

    Hi, I don't know xslt - i just need a modification done to existing xslt file.

    At the moment the page has 2 radio buttons with a submit button, which exeutes the code dependant on the radio option selected.


    Can anyone please help: I want to convert this to two buttons:

    <!-- This is the original code -->
    <xsl:if test="$cTrigger &gt; '1'">
    <xsl:for-each select="Activit y/ObjectGroup[@type='trigger']/Object">

    <xsl:element name="asp:Radio Button">
    <xsl:attribut e name='id'><xsl: value-of select='@name' /></xsl:attribute>
    <xsl:attribut e name='runat'>se rver</xsl:attribute>
    <xsl:attribut e name='GroupName '>triggers</xsl:attribute>
    <xsl:if test="Value[. = 'on']">
    <xsl:attribut e name='Checked'> True</xsl:attribute>
    </xsl:if>
    </xsl:element>

    </xsl:for-each>
    </xsl:if>

    <xsl:if test="$cTrigger &gt; '0'">
    <xsl:element name="asp:Butto n">
    <xsl:attribut e name="id">___Su bmit</xsl:attribute>
    <xsl:attribut e name="runat">se rver</xsl:attribute>
    <xsl:attribut e name="text">Sub mit</xsl:attribute>
    <xsl:attribut e name="CommandNa me">Submit</xsl:attribute>
    </xsl:element>
    </xsl:if>

    This is what I tried, by setting the value of ( test="Value[. = 'on']" ) onClick

    <xsl:if test="$cTrigger &gt; '1'">
    <xsl:for-each select="Activit y/ObjectGroup[@type='trigger']/Object">

    <xsl:element name="asp:Butto n">
    <xsl:attribut e name='id'><xsl: value-of select='@name' /></xsl:attribute>
    <xsl:attribut e name="onClick">
    <xsl:test="Valu e[. = 'on']"></xsl:test>
    <xsl:attribut e name='Checked'> True</xsl:attribute>
    </xsl:attribute>
    <xsl:attribut e name="runat">se rver</xsl:attribute>
    <xsl:attribut e name="text">Sub mit</xsl:attribute>
    <xsl:attribut e name="CommandNa me">Submit</xsl:attribute>
    </xsl:element>
    </xsl:for-each>
    </xsl:if>

    Please help converting this as i'm not sure what i'm doing but i'm trying to set the "test" value.

    Regards
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    Originally posted by ismailc
    This is what I tried, by setting the value of ( test="Value[. = 'on']" ) onClick
    note on test: what you put in quotation marks has to be an expression. "Value[. = 'on']" means: if there (current node) exists an element named "Value" that has an (can not identify type) named "." whose value is "on", do something.
    To me this does not make sense (so to the parser).

    the correct expression depends on what element you want to test. example:
    [CODE=xsl]// xml snippet
    <button value="on" />
    // xsl expression
    <xsl:if test="button[@value = 'on']"></xsl:if>

    // another xml
    <button>
    <value>on</value>
    </button>
    // xsl expression
    <xsl:if test="button[value = 'on']"></xsl:if>[/CODE]
    if you can provide us with the appropriate xml snippet, we can have a look at the matter again, otherwise we're lost in the woods.

    PS: wildcard character is *; . refers to current node, but you can use it only on start of expression or inside xpath functions (e.g. ".", "./parent::*", "name(.)")

    Comment

    Working...