[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: xsl:sort not sorting (brain freeze suspected)

Subject: RE: xsl:sort not sorting (brain freeze suspected)
From: "Brook Ellingwood" <belling@xxxxxxx>
Date: Tue, 25 Oct 2005 18:54:28 -0700
xsl sort not sorting
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>&lt;b&gt;Holiday
Hours:&lt;/b&gt;</b>&lt;br&gt;
			</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>&lt;br&gt;<br/>
		</font>
	</xsl:template>
</xsl:stylesheet>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.