xsl-list
[Top] [All Lists]

click header column to sort data.

2003-05-30 14:49:36
Just in case my first message was not delivery
I have one xml and one xslt file as attachments. 
Please take a look and help me when I click on the
header column and make that column sort.

Thanks

XML file
--------

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="D:\My 
Documents\Download\Adminlist.xslt"?>
<Adminlist>
        <sponsoroffice>
                <OfficeName>Somewhere            </OfficeName>
                <administratorname>
                        <Lname>Bui</Lname>
                        <Fname>Binh</Fname>
                        <Phone>1234567890</Phone>
                        <Email>test(_at_)test(_dot_)test(_dot_)com</Email>
                </administratorname>
        </sponsoroffice>
        <sponsoroffice>
                <OfficeName>Seattle            </OfficeName>
                <administratorname>
                        <Lname>someone</Lname>
                        <Fname>Nobody</Fname>
                        <Phone>0987654321</Phone>
                        <Email>mickey(_at_)dot(_dot_)com</Email>
                </administratorname>
        </sponsoroffice>
        <sponsoroffice>
                <OfficeName>Portland              </OfficeName>
                <administratorname>
                        <Lname>Smith</Lname>
                        <Fname>Blue</Fname>
                        <Phone>3541873658</Phone>
                        <Email>mouse(_at_)dot(_dot_)com</Email>
                </administratorname>
                <administratorname>
                        <Lname>Cat</Lname>
                        <Fname>Eighty</Fname>
                        <Phone>3541867894</Phone>
                        <Email>cat(_at_)dot(_dot_)com</Email>
                </administratorname>
        </sponsoroffice>
</Adminlist>


XSL File
--------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
xmlns:xs="http://www.w3.org/2001/XMLSchema";>
        <xsl:template match="/">
                <html>
                        <head/>
                        <center><h1>Administrator List</h1></center>
                        <center><hr/></center>
                        <body>
                                <xsl:for-each select="Adminlist">
                                        <br/>
                                        <xsl:for-each select="sponsoroffice">
                                                <xsl:if test="position()=1">
                                                        <table width="100%" 
border="0">
                                                                <thead 
style="cursor:hand;
background-color:wheat">
                                                                        <tr>
                                                                                
<td width="205" align="center">
                                                                                
        <h4><span style="font-size:20">Office
Name</span></h4>
                                                                                
</td>
                                                                                
<td width="206" align="center">
                                                                                
        <h4><span style="font-size:20">Last
name</span></h4>
                                                                                
</td>
                                                                                
<td width="184" align="center">
                                                                                
        <h4><span style="font-size:20">First
Name</span></h4>
                                                                                
</td>
                                                                                
<td width="184" align="center">
                                                                                
        <h4><span
style="font-size:20">Phone</span></h4>
                                                                                
</td>
                                                                                
<td width="184" align="center">
                                                                                
        <h4><span
style="font-size:20">Email</span></h4>
                                                                                
</td>
                                                                        </tr>
                                                                </thead>
                                                                <tbody>
                                                                        
<xsl:for-each select="../sponsoroffice">
                                                                                
<tr valign="top"
                                                                                
onmouseover="this.style.backgroundColor='lightyellow'"

                                                                                
onmouseout="this.style.backgroundColor='white'" >
                                                                                
        <td width="205" align="center">
                                                                                
                <xsl:for-each select="OfficeName">
                                                                                
                        <br/>
                                                                                
                        <xsl:apply-templates/>
                                                                                
                        <br/>
                                                                                
                </xsl:for-each>
                                                                                
        </td>
                                                                                
        <td width="206" align="center">
                                                                                
                <xsl:for-each select="administratorname">
                                                                                
                        <br/>
                                                                                
                        <xsl:for-each select="Lname">
                                                                                
                                <xsl:apply-templates/>
                                                                                
                        </xsl:for-each>
                                                                                
                        <br/>
                                                                                
                </xsl:for-each>
                                                                                
        </td>
                                                                                
        <td width="184" align="center">
                                                                                
                <xsl:for-each select="administratorname">
                                                                                
                        <br/>
                                                                                
                        <xsl:for-each select="Fname">
                                                                                
                                <xsl:apply-templates/>
                                                                                
                        </xsl:for-each>
                                                                                
                        <br/>
                                                                                
                </xsl:for-each>
                                                                                
        </td>
                                                                                
        <td width="184" align="center">
                                                                                
                <xsl:for-each select="administratorname">
                                                                                
                        <br/>
                                                                                
                        <xsl:for-each select="Phone">
                                                                                
                                <xsl:apply-templates/>
                                                                                
                                <br/>
                                                                                
                        </xsl:for-each>
                                                                                
                </xsl:for-each>
                                                                                
        </td>
                                                                                
        <td width="184" align="center">
                                                                                
                <xsl:for-each select="administratorname">
                                                                                
                        <br/>
                                                                                
                        <xsl:for-each select="Email">
                                                                                
                                <a text-decoration="underline"
color="blue">
                                                                                
                                        <xsl:attribute
name="href">mailto:<xsl:value-of 
select="." /></xsl:attribute>
                                                                                
                                        <xsl:apply-templates/>
                                                                                
                                </a>
                                                                                
                                <br/>
                                                                                
                        </xsl:for-each>
                                                                                
                </xsl:for-each>
                                                                                
        </td>
                                                                                
</tr>
                                                                        
</xsl:for-each>
                                                                </tbody>
                                                        </table>
                                                </xsl:if>
                                        </xsl:for-each>
                                        <br/>
                                </xsl:for-each>
                        </body>
                </html>
        </xsl:template>
</xsl:stylesheet>




=====
"It is essential to know that to be a happy person, a happy family, a happy 
society, it is very crucial to have a good heart, that is very crucial,"
Dalai Lama

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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



<Prev in Thread] Current Thread [Next in Thread>
  • click header column to sort data., Tham Tinh <=