php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74992 wrong behaviour for attribute "selected"
Submitted: 2017-07-26 09:49 UTC Modified: 2017-07-26 12:25 UTC
From: yuriy at vihv dot org Assigned:
Status: Not a bug Package: XSLT related
PHP Version: 7.0.21 OS: Linux Fedora 24.x86_64
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: yuriy at vihv dot org
New email:
PHP Version: OS:

 

 [2017-07-26 09:49 UTC] yuriy at vihv dot org
Description:
------------
during transformation to XML attribute "selected" always set to empty string.
That might be ok for trasformation to HTML, but for XML it's wrong.

If I rename attribute - all works as expected.
Also on earlier version selected works just fine.

 

Test script:
---------------
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="utf-8" indent="no"/>
    <xsl:template name="selectTemplate">
        <select>
           <option value="123" selected="selected">value</option>
        </select>
    </xsl:template>
</xsl:stylesheet>

Expected result:
----------------
Correct XHTML will be

<select>
    <option value="123" selected="selected">value</option>
</select>

or at least it should be correct HTML5

<select>
    <option value="123" selected>value</option>
</select>

Actual result:
--------------
<select>
   <option value="123" selected="">value</option>
</select>

Firefox treat this element as NOT selected

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-26 10:03 UTC] yuriy at vihv dot org
Oopps, sorry, that's firefox problem. Firebug showed 'selected=""' but source codes as text are correct, just "selected".

Sorry for bothering you.
 [2017-07-26 12:25 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2017-07-26 12:25 UTC] requinix@php.net
as commented
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jan 13 20:01:31 2025 UTC