Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old August 15th, 2008, 09:49 AM
Member
 
Join Date: Sep 2006
Posts: 80
Default 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="Activity/ObjectGroup[@type='trigger']/Object">

<xsl:element name="asp:RadioButton">
<xsl:attribute name='id'><xsl:value-of select='@name' /></xsl:attribute>
<xsl:attribute name='runat'>server</xsl:attribute>
<xsl:attribute name='GroupName'>triggers</xsl:attribute>
<xsl:if test="Value[. = 'on']">
<xsl:attribute name='Checked'>True</xsl:attribute>
</xsl:if>
</xsl:element>

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

<xsl:if test="$cTrigger &gt; '0'">
<xsl:element name="asp:Button">
<xsl:attribute name="id">___Submit</xsl:attribute>
<xsl:attribute name="runat">server</xsl:attribute>
<xsl:attribute name="text">Submit</xsl:attribute>
<xsl:attribute name="CommandName">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="Activity/ObjectGroup[@type='trigger']/Object">

<xsl:element name="asp:Button">
<xsl:attribute name='id'><xsl:value-of select='@name' /></xsl:attribute>
<xsl:attribute name="onClick">
<xsl:test="Value[. = 'on']"></xsl:test>
<xsl:attribute name='Checked'>True</xsl:attribute>
</xsl:attribute>
<xsl:attribute name="runat">server</xsl:attribute>
<xsl:attribute name="text">Submit</xsl:attribute>
<xsl:attribute name="CommandName">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
Reply
  #2  
Old August 28th, 2008, 02:40 PM
Dormilich's Avatar
Expert
 
Join Date: Aug 2008
Location: Leipzig, Germany
Age: 31
Posts: 633
Default

Quote:
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:
Expand|Select|Wrap|Line Numbers
  1. // xml snippet
  2. <button value="on" />
  3. // xsl expression
  4. <xsl:if test="button[@value = 'on']"></xsl:if>
  5.  
  6. // another xml
  7. <button>
  8.   <value>on</value>
  9. </button>
  10. // xsl expression
  11. <xsl:if test="button[value = 'on']"></xsl:if>
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(.)")
Reply
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles