Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old August 1st, 2006, 04:55 PM
Wang Xiaoning
Guest
 
Posts: n/a
Default order-by is an invalid attribute for the "xsl:for-each" element

i put order-by here, but i got the invalid attribut error, what's
missing? thanks

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

<?xml version="1.0" encoding="utf-8" ?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:param name="FirstLetter"></xsl:param>

<xsl:template match="customerlist">
<html>
<body>
<table border="1" frame="box">
<tr>
<TH>Customer</TH>
<TH>Number</TH>
<TH>Address</TH>
</tr>
<xsl:for-each select="customer[substring(@customer_name,1,1)
= $FirstLetter]" order-by="@customer_nuame">
<tr>
<td>
<a
href="customerdetails.aspx?customer_number={@custo mer_number}">
<xsl:value-of select="@customer_name" />
</a>
</td>
<td>
<xsl:value-of select="@customer_number"/>
</td>
<td>
<xsl:value-of select="@address"/>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>

</xsl:stylesheet>

  #2  
Old August 1st, 2006, 05:15 PM
Wang Xiaoning
Guest
 
Posts: n/a
Default Re: order-by is an invalid attribute for the "xsl:for-each" element

i fond i miss

<xsl:sort select ="@customer_name" order ="ascending"/>

  #3  
Old August 1st, 2006, 05:15 PM
Martin Honnen
Guest
 
Posts: n/a
Default Re: order-by is an invalid attribute for the "xsl:for-each" element



Wang Xiaoning wrote:
Quote:
i put order-by here, but i got the invalid attribut error, what's
missing? thanks
Quote:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
Quote:
<xsl:for-each select="customer[substring(@customer_name,1,1)
= $FirstLetter]" order-by="@customer_nuame">
Here is the definition of for-each in XSLT 1.0:
<http://www.w3.org/TR/xslt#for-each>
Where do you see an order-by attribute there?

If you want to sort then you need to use e.g.
<xsl:for-each select="customer[substring(@customer_name,1,1)
= $FirstLetter]">
<xsl:sort select="@customer_name" />
</xsl:for-each>

See <http://www.w3.org/TR/xslt#sorting>.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
  #4  
Old August 2nd, 2006, 05:55 PM
Wang Xiaoning
Guest
 
Posts: n/a
Default Re: order-by is an invalid attribute for the "xsl:for-each" element

you are right, thanks

 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles