XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old December 20th, 2001, 07:40 PM
Talyn2k Talyn2k is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2001
Posts: 7 Talyn2k User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Talyn2k
xsl:sort can not be used here

As you may have guessed from the title, my problem is that when using xsl:sort or xsl:attribute-set I get the error message that it can not be used where it is.
I have put it in the middle of the document same as any of the other xsl tags?
What is the difference between these and others xsl tags I can insert anywhere in the page and how can I fix it.

Coincidentaly, I managed to get hyperlinks and images to work using XSL today. Im well chuffed! Been mucking about with XLink for weeks and it was right infront of me!

Last edited by Talyn2k : December 20th, 2001 at 07:43 PM.

Reply With Quote
  #2  
Old December 24th, 2001, 11:43 AM
numlocked numlocked is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Posts: 26 numlocked User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 36 m 26 sec
Reputation Power: 0
If we could see the part of the code that's giving you trouble, we could probably help a lot more.

numLocked
http://www.numlocked.com

Reply With Quote
  #3  
Old December 25th, 2001, 06:25 AM
Talyn2k Talyn2k is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2001
Posts: 7 Talyn2k User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Talyn2k
Here`s the full code of the XSL document. I`ve checked and double-checked and the tag references match the tags in the xml document as it works without the xsl:sort.
Any help would be appreciated cos i'm confuzzled.

<?xml version="1.0"?>
<HTML xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<head>
<title>Stargate Central - <xsl:value-of select="aliens/@ptitle"/></title>
<link type="text/css" rel="stylesheet" href="style.css"/>
</head>

<BODY>

<xsl:for-each select="aliens/species">
<xsl:sort select="name">
<table border="1" bordercolor="black" width="100%" cellpadding="0" cellspacing="1">
<tr>
<td bgcolor="#008800" colspan="2">
<xsl:value-of select="name"/>

</td>
</tr>
<tr>
<td rowspan="2">
<A>
<xsl:attribute name="href"><xsl:value-of select="imgurl"/></xsl:attribute>
<img>
<xsl:attribute name="src"><xsl:value-of select="image"/></xsl:attribute>
</img>
</A>
</td>

<td>
Homeworld:
<A>
<xsl:attribute name="href"><xsl:value-of select="homeworld"/></xsl:attribute>
<xsl:value-of select="hworldnm"/>
</A>
<br/>
<xsl:value-of select="description"/>
<br/>
<xsl:for-each select="episodes/url">
<A>
<xsl:attribute name="href"><xsl:value-of select="addy"/></xsl:attribute>
<xsl:value-of select="txt"/>
</A>,
</xsl:for-each>
</td>
</tr>
<tr>
<td>
SEE:
<xsl:for-each select="members/url">
<A>
<xsl:attribute name="href"><xsl:value-of select="addy"/></xsl:attribute>
<xsl:value-of select="txt"/>
</A>,
</xsl:for-each>
</td>
</tr>
</table>
</xsl:sort>
</xsl:for-each>
</BODY>
</HTML>

Reply With Quote
  #4  
Old December 25th, 2001, 05:41 PM
numlocked numlocked is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Posts: 26 numlocked User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 36 m 26 sec
Reputation Power: 0
The sort line should read:
<xsl:sort select="name" />

you forgot the "/"

hope that works for ya!

numLocked
http://www.numlocked.com

Reply With Quote
  #5  
Old December 25th, 2001, 06:15 PM
Talyn2k Talyn2k is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2001
Posts: 7 Talyn2k User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Talyn2k
sorry numlocked but that didnt work either

when i access the xsl files (pstyle_aliens.xsl) on its own there are no errors. but when I run the XML file thru it it errors out.

it is definitely pointing to the name tag correctly so that isnt it. I even tried mapping to it straight from root but still get the error.

This is definitely a weird one.

Reply With Quote
  #6  
Old December 25th, 2001, 06:21 PM
numlocked numlocked is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Posts: 26 numlocked User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 36 m 26 sec
Reputation Power: 0
Hrm, that is weird. I don't see anything wrong with it.

There's one thing that you might want to add (it won't effect your problem unfortunately, but it could save you some future hassle):

<xsl:template match="/">

If you change your XML drastically later, having that line in there will save you some trouble when changing the XSL around to adapt to a new XML structure.

Reply With Quote
  #7  
Old December 25th, 2001, 06:25 PM
Talyn2k Talyn2k is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2001
Posts: 7 Talyn2k User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Talyn2k
thanx for the trick numlocked. guess im just gonna have to make sure all the records are in order in the xml doc!

and if anyone else out there has any ideas im open to suggestions!

Reply With Quote
  #8  
Old January 2nd, 2002, 06:21 AM
mrtom mrtom is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2002
Posts: 4 mrtom User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
i think the problem lies in the xmlns definition. you are using the "WD-xsl" which is the old working draft. it didn't have support for sorting.
i always use xmlns:xsl="http://www.w3.org/1999/XSL/Transform" but this can sometimes cause some more errors in which case you need to update your xml libraries.
also as a side note i think it's more correct to have all html tags in lower case to be proper xhtml.


Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > xsl:sort can not be used here


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway