Help with xsl:sort select attribute

admin

Administrator
Staff member
Hi everyone,The following is my xml data:<root><contacts sortcolumn="lastname" sortorder="asc"><contact><firstname>FirstName1</firstname><lastname>LastName1</lastname><email>Email1</email></contact><contact><firstname>FirstName2</firstname><lastname>LastName2</lastname><email>Email2</email></contact>...<contact><firstname>FirstNameX</firstname><lastname>LastNameX</lastname><email>EmailX</email></contact></contacts></root>______________________________________________________The following is my xsl codes:<xsl:for-each select="//contacts/contact"><xsl:sort select="//contacts/@sortcolumn"/><tr><td><xsl:value-of select="firstname"/></td><td><xsl:value-of select="lastname"/></td><td><xsl:value-of select="email"/></td></tr></xsl:for-each>________________________________________________________The xsl:sort seems to ignore the select attribute, and as a result thereis no sorting. It looks like the xsl:sort is not able to get informationfrom its parent or ancestor nodes. It works only when I manually use select="lastname",but after all I want this to take place dynamically.Can anyone please help me with this? Thanks very much!!
 
Back
Top