|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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> |
|
#4
|
|||
|
|||
|
The sort line should read:
<xsl:sort select="name" /> you forgot the "/" ![]() hope that works for ya! numLocked http://www.numlocked.com |
|
#5
|
|||
|
|||
|
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. |
|
#6
|
|||
|
|||
|
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. |
|
#7
|
|||
|
|||
|
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! |
|
#8
|
|||
|
|||
|
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. ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > xsl:sort can not be used here |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|