xsl-list
[Top] [All Lists]

Passing Parameters to XSL

2004-01-17 00:02:50
 
   Hi All,
     Does any one have an aspx code to pass a parameter to an XSL 

I am hereby giving My XML and XSl ....I want to perform a dynamic sorting
depending on which Col Header the User clicks.
I am new to please.Please do help with all suggetsions.If any body has the
aspx code also please do forward it.

Thanks in advance..


<xsl:transform version="1.0"
    xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
    xmlns:msxsl ="urn:schemas-microsoft-com:xslt">    
    <xsl:output method="html"></xsl:output>         
    <xsl:param name ="sortBy">country</xsl:param>
    <xsl:template match="/"> 
    <html>
    <body>
    <div align ="left">
     Sort By:       
       <xsl:value-of select="$sortBy"></xsl:value-of>
    </div>   
    <table width="210" border="2pt" cellspacing="0" cellpadding="3" 
        bordercolor="#dddddd" style="border-collapse:collapse;">        
        <tr bgcolor="#9acd32">          
                <th align="Left"><a class="clickanchor"
onclick="ClickedMe('Country');" >Country</a></th>        
                <th align="Left"><a class="clickanchor"
onclick="ClickedMe('AreaCode');" >AreaCode</a></th> 
                <th align="Left"><a class="clickanchor"
onclick="ClickedMe('AreaDescription');">AreaDescription</a></th>

        </tr>   
        
        <xsl:for-each  select ='locations/area'>        
        <xsl:sort select="areadescription"/>
                <tr>                    
                        <td class="Normal">
                                <center>
                                        <xsl:value-of select ='country'/>
                                </center>
                        </td>
                        <td class="Normal">
                                <center>
                                        <xsl:value-of select ='areacode'/>
                                </center>
                        </td>
                        <td class="Normal">
                                <left>
                                        <xsl:value-of select
='areadescription'/>
                                </left>
                        </td>
                </tr>
        </xsl:for-each>
      </table>
      </body>
      </html>
      </xsl:template>
</xsl:transform>





----------------------------------------------------------------------------
------------------------------------

<?xml version="1.0" ?>
<locations>
    <area>
        <country>KSA</country>
        <areacode>A</areacode>
        <areadescription>ABHA AREA
</areadescription>
    </area>
    <area>
        <country>KSA</country>
        <areacode>D</areacode>
        <areadescription>DHAHRAN AREA
</areadescription>
    </area>
    <area>
        <country>KSA</country>
        <areacode>F</areacode>
        <areadescription>TAIF AREA
</areadescription>
    </area>
    <area>
        <country>KSA</country>
        <areacode>H</areacode>
        <areadescription>HARADH AREA
</areadescription>
    </area>
    <area>
        <country>KSA</country>
        <areacode>J</areacode>
        <areadescription>JEDDAH AREA
</areadescription>
    </area>
</locations>




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



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