This list is really for Saxon-specific problems, not for general XSLT coding questions, which are best directed to xsl-list at mulberrytech.com.
 
xsl:for-each select="." selects a single node (the context node), which it then sorts. Obviously sorting a list containing one node is not particularly useful. You need to do the sorting in the template that processes the <root> element and applies-templates to the set of <Contact> elements.
 
Michael Kay
-----Original Message-----
From: saxon-help-admin@lists.sourceforge.net [mailto:saxon-help-admin@lists.sourceforge.net] On Behalf Of Howard Greenblatt
Sent: 28 July 2003 19:13
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Newbie

I really am new at this. I have a simple Xml doc which I cannot get to sort. What am I doing wrong

<?xml version='1.0' ?>
<?xml-stylesheet type="text/xsl" xhref="bb.xsl"?>
<root>
<Contact
        Boutique='Pall'
        displayName='Fred'
        streetAddress='30 Wes'
 />
<Contact
        Boutique='Boston Energy"
        displayName='Pauli'
        telephoneNumber='(900) 222-7009'
 />
<Contact
        Boutique='Palladian Research'
        displayName='Mellisa'
 />
</root>


And a xsl of

<xsl:stylesheet
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:disable-output-escaping='yes'
 version="1.0"
>

<xsl:output indent='yes'/>
<xsl:strip-space elements='*' />

<!--  comment -->

<xsl:template match="@*|node()">
                <xsl:apply-templates select="@*|node()"/>      
        </xsl:template>


<xsl:template match="Contact">
                                        <xsl:for-each select=".">
                                         <xsl:sort select="@Boutique" data-type='text'/>
                                 <xsl:copy-of select="." />
                        </xsl:for-each>
</xsl:template>


</xsl:stylesheet>


Howard Greenblatt
hgreenblatt@soleilgroup.com