xsl-list
[Top] [All Lists]

Re: Radio Button Values

2004-12-28 06:51:48
I still get the xsl:variable may not be used in namespace error when I try to run the code below.

From: Jannis Pohlmann <info(_at_)sten-net(_dot_)de>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Radio Button Values
Date: Tue, 28 Dec 2004 12:58:33 +0100

Hello,

try out the code below. It is untested but supposed to work. I couldn't help moving "width" and "border" attributes into the "style" attribute of the table - just conformance reasons. Anyway, normally I use <xsl:element name="a"/> instead of <a/> but in this case I avoided this to make reading it easier. If you ask yourself why <xsl:text> is was used in <xsl:attribute/>: it is to avoid unnecessary spaces and line breaks in the function call.

Regards, Jannis.


<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="uri:xsl">

<xsl:template match="/">
<table style="background-color:#fff; font:8pt Courier New; width:100%; border:0em;">
<tr>
<th colspan="2" align="center">
<xsl:value-of select="DataTable/TableHeader"/>
</th>
</tr>
<xsl:apply-templates select="DataTable/Cell">
</xsl:template>

<xsl:template match="//DataTable/Cell">
<xsl:variable name="rowID"><xsl:number count="//DataTable/Cell" level="any" format="1"/></xsl:variable>

<tr>
<td>
<input type="radio" name="Primary" value="{$rowID}" onClick="clearTheOld('P')"/> <input type="radio" name="Secondary" value="{$rowID}" onClick="clearTheOld('S')"/>
<xsl:value-of select="Caption"/>
</td>
<td>
<a>
<xsl:attribute name="href" select='#'/>
<xsl:attribute name="onClick">
<xsl:value-of select="FunctionName"/>
<xsl:text>(&quot;Main?ModuleID=</xsl:text>
<xsl:value-of select="ModuleID"/>
<xsl:text>&amp;CID=</xsl:text>
<xsl:value-of select="CID"/>
<xsl:text>&amp;SID=</xsl:text>
<xsl:value-of select="SID"/>
<xsl:text>&amp;PID=</xsl:text>
<xsl:value-of select="PID"/>
<xsl:text>&amp;Command=</xsl:text>
<xsl:value-of select="Command"/>
<xsl:text>&amp;Seq=</xsl:text>
<xsl:value-of select="Seq"/>
<xsl:text>&quot;,validateSecurityLevel())</xsl:text>
</xsl:attribute>
<xsl:value-of select="Operation"/>
</a>
</td>
</tr>
</xsl:template>





Thorr Giddings schrieb:

It does not recognize the variable in the template, but the code is doing a for each and I am sure I am supposed to be doing an apply-template, I just don't know how, here is the exact xsl code:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="uri:xsl">


<xsl:template match="/">
<table style="BACKGROUND-COLOR: white;font: 8pt Courier New;" width="100%" border="0">


<td colspan="2" align="center">
<SPAN class="label"><STRONG><xsl:value-of select="DataTable/TableHeader" /></STRONG></SPAN>
</td>

<xsl:for-each select="DataTable/Cell">
<xsl:variable name="rowid"><xsl:number count="/" level="any" format="1"/></xsl:variable>

<tr>
<td >
<input type="radio" name="Primary" value="{$rowid}" onClick="clearTheOld('P')">
</input>

<input type="radio" name="Secondary" value="${rowid}" onClick="clearTheOld('S')">
</input>


<xsl:value-of select="Caption" />
</td>
<td>
<a>
<xsl:attribute name="href"> # </xsl:attribute>
<xsl:attribute name="onclick">
<xsl:value-of select="FunctionName" />(&quot;Main?ModuleID=
<xsl:value-of select="ModuleID" />&amp;CID=
<xsl:value-of select="CID" />&amp;SID=
<xsl:value-of select="SID" />&amp;PID=
<xsl:value-of select="PID" />&amp;Command=
<xsl:value-of select="Command" />&amp;Seq=
<xsl:value-of select="Seq" />&quot;,validateSecurityLevel())
</xsl:attribute>
<xsl:value-of select="Operation" />
</a>
</td>
</tr>
</xsl:for-each>

</table>
</xsl:template>
</xsl:stylesheet>


Thanks,

Thorr

From: Jannis Pohlmann <info(_at_)sten-net(_dot_)de>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Radio Button Values
Date: Mon, 27 Dec 2004 16:07:31 +0100

With

<xsl:template match="/path/to/yourElement">
<xsl:variable name="rowid"><xsl:number count="/path/to/yourElement" level="any" format="1"/></xsl:variable> <input type="radio" name="Primary" value="{$rowid}" onClick="clearTheOld('P')"/> <input type="radio" name="Secondary" value="{$rowid}" onClick=clearTheOld('S')"/>
<br/>
</xsl:template>

you should get something like this:

<input type="radio" name="Primary" value="1" onClick="clearTheOld('P')"/>
<input type="radio" name="Secondary" value="1" onClick=clearTheOld('S')"/>
<br/>
<input type="radio" name="Primary" value="2" onClick="clearTheOld('P')"/>
<input type="radio" name="Secondary" value="2" onClick=clearTheOld('S')"/>
<br/>
<input type="radio" name="Primary" value="3" onClick="clearTheOld('P')"/>
<input type="radio" name="Secondary" value="3" onClick=clearTheOld('S')"/>
<br/>

If you want the variable to start with value="11", you will have to use value="{$rowid + 10}" instead of value="{$rowid}"

Regards,
Jannis


Thorr Giddings schrieb:

I have my xml data source and what I end up with is a list of lets say
3-10 elements. For each element in the list there are two radio
buttons, they form two columns as they go down the list. My question
is, how do I set unique values to each row of radio buttons. Here is
what I kind of what I want to see in HTML:

<input type="radio" name="Primary" Value ="11" onClick="clearTheOld('P')" />
<input type="radio" name="Secondary" Value ="11"
onClick="clearTheOld('S')" />
</BR>
<input type="radio" name="Primary" Value ="12" onClick="clearTheOld('P')" />
<input type="radio" name="Secondary" Value ="12"
onClick="clearTheOld('S')" />
</BR>
<input type="radio" name="Primary" Value ="13" onClick="clearTheOld('P')" />
<input type="radio" name="Secondary" Value ="13"
onClick="clearTheOld('S')" />
</BR>
<input type="radio" name="Primary" Value ="14" onClick="clearTheOld('P')" />
<input type="radio" name="Secondary" Value ="14"
onClick="clearTheOld('S')" />
</BR>
<input type="radio" name="Primary" Value ="15" onClick="clearTheOld('P')" />
<input type="radio" name="Secondary" Value ="15"
onClick="clearTheOld('S')" />
</BR>
<input type="radio" name="Primary" Value ="16" onClick="clearTheOld('P')" />
<input type="radio" name="Secondary" Value ="16"
onClick="clearTheOld('S')" />

Any ideas? I am guessing I can set the values with a variable, but I
just can't seem to figure that out.

Thanks.

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar ï¿Å? get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


--~------------------------------------------------------------------
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>
--~--


_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar � get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


--~------------------------------------------------------------------
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>
--~--


_________________________________________________________________
Don?t just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/


--~------------------------------------------------------------------
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>
--~--



<Prev in Thread] Current Thread [Next in Thread>