xsl-list
[Top] [All Lists]

Re: [xsl] Building a HTML checkbox with php:function

2006-09-10 05:58:00
Well I'm not sure what the php function returns but you can just use an xsl:if or possibly xsl:choose to see if the box needs to be checked or not. If it does create the checked attribute with the value checked, if not omit the checked attribute altogether.

Joe

----- Original Message ----- From: "Ruben Trancoso" <rubentrancoso(_at_)gmail(_dot_)com>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Sunday, September 10, 2006 1:50 PM
Subject: Re: [xsl] Building a HTML checkbox with php:function


Thanx Joe,

the html output made the correct html. But one question remain about
how can I test a given value from a php:function to avoid all
attribute?

Ruben

On 9/10/06, Joe Fawcett <joefawcett(_at_)hotmail(_dot_)com> wrote:
<input type="checkbox" checked>
is HTML/SGML shorthand for
<input type="checkbox" checked="checked">

If you use <xsl:method output="html" /> and create the output
checked="checked" then the serialiser will construct the correct HTML. If
the checkbox is not checked leave the attribute off altogether.

Joe

----- Original Message -----
From: "Ruben Trancoso" <rubentrancoso(_at_)gmail(_dot_)com>
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Sunday, September 10, 2006 1:18 PM
Subject: [xsl] Building a HTML checkbox with php:function


Hi,

I´m trying to figure out how is possible to build a HTML checkbox in a
transformation. The main problem, I think, is the HTML syntax for this
widget. A checkbox input need a attribute 'checked' without a value.
So the input tag

<input type="checkbox" name="CheckIt">

after checked and submited, need to be reconstructed as this

<input type="checkbox" name="CheckIt" checked>

I´m using parameters to test if a widget need review. To a textfield
it´s easy cause I just return the value for the attribute value.

With a checbox I need to put and attribute named checked and I realy
don´t catch how to do it with stylesheets. Maybe build all widget as
text isn´t better?

<xsl:template match="x:check">
  <input type="checkbox">
     <xsl:attribute name="name">
        <xsl:value-of select="@name"/>
     </xsl:attribute>
     <xsl:if test="$review='true'">
        <xsl:attribute name="checked">
           <xsl:value-of
select="php:function('eval_xsl_review_var',@name,'check')" />
        </xsl:attribute>
     </xsl:if>
  </input>
</xsl:template>

--
Quando um homem não acredita em Deus,
não é que não acredite mais em nada -
é que ele acredita em qualquer coisa.
(G. K. Chesterton)

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--
Quando um homem não acredita em Deus,
não é que não acredite mais em nada -
é que ele acredita em qualquer coisa.
(G. K. Chesterton)

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--