Gil
-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by Gil
-
-
Lawsy! It don't work wid "if" neither! This code works:
<xsl:for-each select="catalog/cd"> <xsl:sort select="price"/> <xsl:if test="price > 10"> <tr> <td><xsl:value-of select="title" /></td> <td><xsl:value-of select="artist" /></td> <td style="text-align:right"><xsl:value-of select="price" /></td> </tr> </xsl:if> </xsl:for-each>
This code gets a parsing error:
<xsl:for-each select="catalog/cd"> <xsl:sort select="price"/> <xsl:if test="price < 10"> <tr> <td><xsl:value-of select="title" /></td> <td><xsl:value-of select="artist" /></td> <td style="text-align:right"><xsl:value-of select="price" /></td> </tr> </xsl:if> </xsl:for-each>
Well, if that don't beat all! The onliest thing I changed is: in the 'if' statement I changed ">" to "<". Nothin else! I promise! The error messages in both cases point to the "&" in "<". Can anyone help me usderstand why these don't work? --Gil
-
I'm following the XLT Tutorial at http://www.w3schools...sl/xsl_sort.asp. I have been playing with the wonderful Try-It Editor. (Thank you to whomever invented that thing!) This code works fine:
<?xml version="1.0" encoding="ISO-8859-1"?><!-- Edited by XMLSpy® --><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/"> <html> <body> <h2>My CD Collection</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>Title</th> <th>Artist</th> <th>Price</th> </tr> <xsl:for-each select="catalog/cd[price > 8]"> <xsl:sort select="price"/> <tr> <td><xsl:value-of select="title" /></td> <td><xsl:value-of select="artist" /></td> <td style="text-align:right"><xsl:value-of select="price" /></td> </tr> </xsl:for-each> </table> </body> </html></xsl:template></xsl:stylesheet>
Any number I put to replace the "8" at the end of the for-each line...
<xsl:for-each select="catalog/cd[price > 8]">
...works as one might expect. However, if I change the > to < (and nothing else!) in that same line,...
<?xml version="1.0" encoding="ISO-8859-1"?><!-- Edited by XMLSpy® --><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/"> <html> <body> <h2>My CD Collection</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>Title</th> <th>Artist</th> <th>Price</th> </tr> <xsl:for-each select="catalog/cd[price < 8]"> <xsl:sort select="price"/> <tr> <td><xsl:value-of select="title" /></td> <td><xsl:value-of select="artist" /></td> <td style="text-align:right"><xsl:value-of select="price" /></td> </tr> </xsl:for-each> </table> </body> </html></xsl:template></xsl:stylesheet>
...my browser [Firefox version 15.0] reports a parsing error. Why is that, do you suppose? --Gil
XSLT Tutorial: Less-than doesn't work
in XSLT/XSL-FO
Posted · Edited by Gil
Wow, Martin, thanks! I guess client-side XSLT just isn't yet ready for me and my projects. I love the concept, but I'm more interested right now in things that work.
It's a relief, actually. It tells me that I don't need to learn to use XSLT just now. I can go ahead and implement with XML and POJ (Plain Old JavaScript) -- both of which seemingly have matured enough for me. I'll put client-side XSLT off for another year or so and then check back in. Thanks for the clarity! Thanks also for the suggestions about server-side XSLT. That won't work on my current project, but I'm keeping it in mind. --Gil