xsl-list
[Top] [All Lists]

xsl:sort not sorting (brain freeze suspected)

2005-10-25 18:32:36
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>



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>