Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 697651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:11:24+00:00 2026-05-14T03:11:24+00:00

Trying to mark radio inputs as selected with XSLT 1.0 using the below xslt

  • 0

Trying to mark radio inputs as selected with XSLT 1.0 using the below xslt code but this does not produced the desired result

desrired result

<input type="radio" value="available" title="email" selected="selected" />

Actual output

  <input type="radio" value="available" title="email" selected />

Anyone any ideas why not please?

XSLT

<xsl:variable name="selected">selected</xsl:variable>
  <xsl:for-each select="item">
   <tr>

     <td><xsl:value-of select="title" /></td>

     <td>
       <input type="radio" value="available" >
       <xsl:attribute name="name">
        <xsl:value-of select="title" />
       </xsl:attribute>
       <xsl:if test="category='available'">
         <xsl:attribute name="selected">
          <xsl:value-of select="$selected"/>
         </xsl:attribute>
       </xsl:if>
       </input>
     </td>

     <td>
       <input type="radio" value="unavailable" >
       <xsl:attribute name="name">
        <xsl:value-of select="title" />
       </xsl:attribute>
       <xsl:if test="category='unavailable'">
        <xsl:attribute name="selected">
         <xsl:value-of select="$selected"/>
        </xsl:attribute>
       </xsl:if>
       </input>
     </td>


     <td>
       <input type="radio" value="warning" >

       <xsl:if test="category='warning'">
        <xsl:attribute name="selected">
            <xsl:value-of select="$selected"/>
           </xsl:attribute>
           <xsl:attribute name="name">
        <xsl:value-of select="title" />
       </xsl:attribute>
       </xsl:if>
       </input>
     </td>

   </tr>

   </xsl:for-each>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:11:24+00:00Added an answer on May 14, 2026 at 3:11 am

    This is due to your output mode. Have you instructed your XSLT processor to output HTML (rather than XML)? If so, the output serializer is adapted to adjust for the idiosyncracies of HTML; so that for instance it generates <br> rather than <br/> and that it may leave out attribute content if identical to attribute name.

    This shouldn’t be a problem; it’s legal HTML, by the way.

    For more details; the spec has a section on what exactly html output mode is supposed to do. Amonst other things it says…

    The html output method should output boolean attributes (that is attributes with only a single allowed value that is equal to the name of the attribute) in minimized form. For example, a start-tag written in the stylesheet as

    <OPTION selected="selected">
    

    should be output as

    <OPTION selected>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get users to mark their places, I am using this
We are trying to write a code to mark table rows using html5 local
I'm trying to write Unicode characters (♠) using System.out , and a question mark
I'm trying to parse text-formatting. I want to mark inline code, much like SO
I'm trying to add upload controls to the page. This HTML mark-up with JavaScript
Been trying to find a solution for this for a while with not much
Along the lines of this question . I'm trying to mark an existing Invoice
I'm trying to mark an item as read using Google reader API. I'm calling:
I'm trying to implement something like Mark Story's Down for Maintenance page using CakePHP
i'm trying to display the average mark of students, but it's display the wrong

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.