[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: xsl:sort not sorting (brain freeze suspected)
Still haven't received my own message back from the list, but wanted to note that predictably I saw the problem 30 seconds after clicking "send." It was a silly context error caused by not specifying a select on apply-templates: <xsl:apply-templates select="*/Row"> Thanks for putting up with my noise. -----Original Message----- From: Brook Ellingwood Sent: Tuesday, October 25, 2005 6:33 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: xsl:sort not sorting (brain freeze suspected) I'm pretty sure I'll be sheepish after seeing the answer, but I've got a sort that won't, and I've been staring at it for an hour without seeing the problem. The transformation is so simple that I feel like I'm looking right through the problem. It probably doesn't help that I've been in meetings for six months, instead of actually doing stuff... Sample XML: <Import> <Row> <intEntryID>114</intEntryID> <strStoreName>34 Baileys Crossroads</strStoreName> <strComment>TEST</strComment> <strFirstDay>01/2/2006</strFirstDay> <strOpenTime>1:00</strOpenTime> <strCloseTime>7:00</strCloseTime> <dateSubmit>10/13/2005</dateSubmit> <timeSumbit>4:32:32 PM</timeSumbit> </Row> <Row> <intEntryID>115</intEntryID> <strStoreName>11 Seattle</strStoreName> <strComment>Optional</strComment> <strFirstDay>11/23/2005</strFirstDay> <strOpenTime>8:00</strOpenTime> <strCloseTime>11:00</strCloseTime> <dateSubmit>10/13/2005</dateSubmit> <timeSumbit>4:36:24 PM</timeSumbit> </Row> </Import> Complete XSL: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> <xsl:template match="/"> <h3>Stores Reporting</h3> <xsl:apply-templates> <xsl:sort select="substring-before(strStoreName, ' ')"/> </xsl:apply-templates> </xsl:template> <xsl:template match="Row"> <xsl:variable name="lastRow" select="preceding-sibling::*[1]/strStoreName"/> <xsl:if test="$lastRow != ./strStoreName or not($lastRow)"> <p>Store ID: <xsl:value-of select="strStoreName"/> </p> <font size="2"> <b><b>Holiday Hours:</b></b><br> </font> <br/> </xsl:if> <font size="2"> <xsl:if test="substring-before(strFirstDay, '/') = '11'">Nov. </xsl:if> <xsl:if test="substring-before(strFirstDay, '/') = '12'">Dec. </xsl:if> <xsl:if test="substring-before(strFirstDay, '/') = '01'">Jan. </xsl:if> <xsl:value-of select="substring-before(substring-after(strFirstDay, '/'), '/')"/>: <xsl:value-of select="strOpenTime"/><xsl:if test="strOpenTime != 'CLOSED'"> am - <xsl:value-of select="strCloseTime"/>pm</xsl:if><br><br/> </font> </xsl:template> </xsl:stylesheet>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|