Re: [xsl] XSL checkbox

Subject: Re: [xsl] XSL checkbox
From: "Adrian Popescu" <adrian@xxxxxxxxxxxx>
Date: Tue, 18 May 2004 18:55:45 +0300
thank you....is work but not in Pocket IE:((((
----- Original Message ----- 
From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, May 18, 2004 6:38 PM
Subject: Re: [xsl] XSL checkbox


> Sorry, I misunderstood anyway, you want to highlight the table row. In
that
> case you can chnage the script to:
> function toggleColour(Element)
> {
>   var oRow = Element.parentElement;
>   while (true)
>   {
>     if (oRow.tagName.toLowerCase() == "tr")
>     {
>        break;
>      }
>     oRow = oRow.parentElement
>   }
>   if (oRow.bgColor == "#ffff00"
>  {
>    oRow.bgColor = "#ffffff";
>  }
>   else
>   {
>    oRow.bgColor = "#ffff00";
>   }
> }
> ]]>
> </script>
>
> -- 
> Joe
>
> ----- Original Message ----- 
> From: "Adrian Popescu" <adrian@xxxxxxxxxxxx>
> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> Sent: Tuesday, May 18, 2004 4:17 PM
> Subject: Re: [xsl] XSL checkbox
>
>
> >I think because of "style"
> > ----- Original Message ----- 
> > From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
> > To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> > Sent: Tuesday, May 18, 2004 6:13 PM
> > Subject: Re: [xsl] XSL checkbox
> >
> >
> >> What is the HTMl that is produced? I've just looked at the Pocket PC
> >> specs
> >> but can't see why it shouldn't work.
> >>
> >> -- 
> >> Joe
> >> ----- Original Message ----- 
> >> From: "Adrian Popescu" <adrian@xxxxxxxxxxxx>
> >> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> >> Sent: Tuesday, May 18, 2004 4:00 PM
> >> Subject: Re: [xsl] XSL checkbox
> >>
> >>
> >> > 10x.......it doesnt't work with Pocket PC Internet Explorer but 10x
> > anyway
> >> > ----- Original Message ----- 
> >> > From: "Joe Fawcett" <joefawcett@xxxxxxxxxxx>
> >> > To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> >> > Sent: Tuesday, May 18, 2004 5:49 PM
> >> > Subject: Re: [xsl] XSL checkbox
> >> >
> >> >
> >> >> ----- Original Message ----- 
> >> >> From: "Adrian Popescu" <adrian@xxxxxxxxxxxx>
> >> >> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> >> >> Sent: Tuesday, May 18, 2004 3:33 PM
> >> >> Subject: Re: [xsl] XSL checkbox
> >> >>
> >> >>
> >> >> >I am newbie in XSL and I search ALL GOOGLE for an example:((
> >> >> >
> >> >> > this is my XSL
> >> >> >
> >> >> > <?xml version="1.0"?>
> >> >> > <xsl:stylesheet xmlns:xsl="uri:xsl">
> >> >> >  <xsl:template match="/">
> >> >> >    <SCRIPT>
> >> >> >    function change(title_id)
> >> >> >    {
> >> >> >      alert(title_id);
> >> >> >      var root = detailXSL.documentElement;
> >> >> >      var selectedElems =  root.selectNodes("//xsl:for-each");
> >> >> >      var ifStatement = selectedElems.item(0);
> >> >> >      ifStatement.attributes(0).text =
> >> >> >                      "@title_id[.='" + title_id + "']";
> >> >> >
> >> >> >
> >> >> > document.write(titles.transformNode(detailXSL.documentElement));
> >> >> >    }
> >> >> >    </SCRIPT>
> >> >> >    <H3>Titles</H3>
> >> >> >    <TABLE BORDER="1" CELLPADDING="1" CELLSPACING="0">
> >> >> >      <TR>
> >> >> >        <TD BGCOLOR="#C0C0C0"><B>Title</B></TD>
> >> >> >        <TD BGCOLOR="#C0C0C0"><B>Details</B></TD>
> >> >> >      </TR>
> >> >> >      <xsl:for-each select="titlelist/titles" order-by="@title">
> >> >> >        <TR>
> >> >> >          <TD VALIGN="top"><xsl:value-of select="@title"/></TD>
> >> >> >          <TD VALIGN="top"><INPUT>
> >> >> >            <xsl:attribute name="TYPE">checkbox</xsl:attribute>
> >> >> >            <xsl:attribute name="VALUE">c1</xsl:attribute>
> >> >> >            <xsl:attribute name="ONCLICK">
> >> >> >
> >> >> >                   <xsl:attribute
> >> >> > name="backgroundcolor">yellow</xsl:attribute>
> >> >> >
> >> >> >               <xsl:apply-templates/>
> >> >> >
> >> >> >            </xsl:attribute>
> >> >> >          </INPUT></TD>
> >> >> >        </TR>
> >> >> >      </xsl:for-each>
> >> >> >    </TABLE>
> >> >> >    <XML ID="titles" SRC="titles.xml"></XML>
> >> >> >    <XML ID="detailXSL" SRC="details.xsl"></XML>
> >> >> >  </xsl:template>
> >> >> > </xsl:stylesheet>
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >> >> As was said this seems more like an HTML question but you are using
> >> >> xsl:attribute incorrectly.
> >> >> The htnl you need is:
> >> >> <input type="checkbox" onclick="toggleColour(this);">
> >> >> so your xsl should be (I haven't checked any other stuff):
> >> >> <INPUT>
> >> >>             <xsl:attribute name="TYPE">checkbox</xsl:attribute>
> >> >>             <xsl:attribute name="VALUE">c1</xsl:attribute>
> >> >>             <xsl:attribute name="ONCLICK">
> >> >>            toggleColour(this);
> >> >>            </xsl:attribute>
> >> >>
> >> >>                <xsl:apply-templates/>
> >> >> Then output the following script block somewhere, as you have with
> >> >> your
> >> >> other block:
> >> >>
> >> >> <script>
> >> >> <![CDATA[
> >> >>
> >> >>   function toggleColour(Element)
> >> >>  {
> >> >>     if (Element.style.backgroundColor == "#ffff00"
> >> >>    {
> >> >>      Element.style.backgroundColor = "#ffffff";
> >> >>    }
> >> >>    else
> >> >>    {
> >> >>      Element.style.backgroundColor = "#ffff00";
> >> >>    }
> >> >>  }
> >> >> ]]>
> >> >> </script>
> >> >>
> >> >> Now you could put that code into an inline event handler but it
would
> > be
> >> >> rather messy :)
> >> >>
> >> >> -- 
> >> >>
> >> >> Joe

Current Thread