Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

xml - <XSL:for-each> skip nodes with specific values -


still having hard time grasping of harder templates great.

right using simple for-each loop sorts , shows data in table. want same thing skip on nodes "state" = "talking out" below current style sheet , below xml. thinking add for-each inside of current loop ignores nodes meet criteria. escaping single quotes since part of larger php script.

<?xml version="1.0" encoding="iso-8859-1"?>  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform">  <xsl:template match="/">   <html>   <body>     <table cellpadding="3" cellspacing="0" width="390">       <tr>         <th style="text-align:left;"><span style="font:20px arial; font-weight:bold;">agent name</span></th>         <th style="text-align:center;"><span style="font:20px arial; font-weight:bold;">state</span></th>         <th style="text-align:center;"><span style="font:20px arial; font-weight:bold;">time</span></th>       </tr>       <xsl:for-each select="newdataset/agentsales"> <tr>  <xsl:if test="(position() mod 2 = 1)">     <xsl:attribute name="bgcolor">#cccccc</xsl:attribute>     </xsl:if>   <xsl:if test="agentsales[state=\'talking out\']">      </xsl:if>          <td style="text-align:left;"><span style="font:14px arial; font-weight:bold;"><xsl:value-of select="agentname"/></span></td>         <td style="text-align:center;"><span style="font:14px arial; font-weight:bold;"><xsl:value-of select="state"/></span></td>     <td style="text-align:center;"><span style="font:14px arial; font-weight:bold;"><xsl:value-of select="time"/></span></td> </tr>           </xsl:for-each>     </table>   </body>   </html> </xsl:template> </xsl:stylesheet> 

here xml

<?xml version="1.0" encoding="iso-8859-1"?> <newdataset>   <agentsales>     <agentname>mccallister aaron</agentname>     <state>talking out</state>     <reason />     <time>9</time>   </agentsales>   <agentsales>     <agentname>appelhans barry</agentname>     <state>talking out</state>     <reason />     <time>1</time>   </agentsales>   <agentsales>     <agentname>arredondo karla</agentname>     <state>talking out</state>     <reason />     <time>0</time>   </agentsales>   <agentsales>     <agentname>wooters chad</agentname>     <state>talking in</state>     <reason />     <time>5</time>   </agentsales>   <agentsales>     <agentname>landini eugene</agentname>     <state>not ready</state>     <reason>training</reason>     <time>16</time>   </agentsales>   <agentsales>     <agentname>brown eyes jonette</agentname>     <state>not ready</state>     <reason>training</reason>     <time>13</time>   </agentsales> </newdataset> 

while "apply-templates" may seem uncomfortable compared "for-each", perhaps example can show power...

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform">     <xsl:template match="/">         <html>             <body>                 <table cellpadding="3" cellspacing="0" width="390">                     <tr>                         <th style="text-align:left;"><span style="font:20px arial; font-weight:bold;">agent name</span></th>                         <th style="text-align:center;"><span style="font:20px arial; font-weight:bold;">state</span></th>                         <th style="text-align:center;"><span style="font:20px arial; font-weight:bold;">time</span></th>                     </tr>                     <xsl:apply-templates select="newdataset/agentsales[state!='talking out']"/>                 </table>             </body>         </html>     </xsl:template>     <xsl:template match="agentsales">         <tr>             <xsl:if test="(position() mod 2 = 1)">                 <xsl:attribute name="bgcolor">#cccccc</xsl:attribute>             </xsl:if>             <td style="text-align:left;"><span style="font:14px arial; font-weight:bold;"><xsl:value-of select="agentname"/></span></td>             <td style="text-align:center;"><span style="font:14px arial; font-weight:bold;"><xsl:value-of select="state"/></span></td>             <td style="text-align:center;"><span style="font:14px arial; font-weight:bold;"><xsl:value-of select="time"/></span></td>         </tr>     </xsl:template> </xsl:stylesheet> 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -