xsl-list
[Top] [All Lists]

RE: [xsl] Sort By Multiple Values?

2007-12-27 13:41:29
Quoting "Bjorndahl, Brad" <brad(_dot_)bjorndahl(_at_)thermofisher(_dot_)com>:

Hi,
Your sort statement should probably be something like:
 <xsl:sort select="ability/@rank" order="ascending"/>
because the language element does not have a rank attribute.

Thanks, but when I put it in, it made no difference. What is stranger is, it appears that when as Abel said, telling me to insert in
     <xsl:sort select="type" order="ascending"/>
  after the
   <xsl:sort select="ability/@rank" order="ascending"/>,
it generates a different order compared with the one without before. Before, XML 1.0 was the first element that is on the left, but now is HTML. However, what it does not do is that it should have kept CSS in the first one, since it has the same ranking.

  What have I done wrong?

Here is the document again:

<computer>
           <language>
               <ability rank="1">XML 1.0</ability>
               <type>XML</type>
           </language>
           <language>
               <ability rank="1">XSLT 1.0</ability>
               <type>XML</type>
           </language>
          <language>
               <ability rank="2">XSLT 2.0</ability>
               <type>XML</type>
           </language>
           <language>
               <ability rank="1">HTML 4.01 / XHTML 1.0</ability>
               <type>HTML</type>
           </language>
           <language>
               <ability rank="1">CSS</ability>
               <type>HTML</type>
           </language>

Brad


-----Original Message-----
From: Alice Wei [mailto:ajwei(_at_)indiana(_dot_)edu]
Sent: December 27, 2007 1:29 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Sort By Multiple Values?

Hi,

Sorry, I have messed up my previous document in the cut and paste.
Here is the "correct" document.

I have a document here where I am attempting to sort it using multiple
values. Here is the XML:

 <computer>
           <language>
               <ability rank="1">XML 1.0</ability>
               <type>XML</type>
           </language>
           <language>
               <ability rank="1">XSLT 1.0</ability>
               <type>XML</type>
           </language>
           <language>
               <ability rank="2">XSLT 2.0</ability>
               <type>XML</type>
           </language>
           <language>
               <ability rank="1">HTML 4.01 / XHTML 1.0</ability>
               <type>HTML</type>
           </language>
           <language>
               <ability rank="1">CSS</ability>
               <type>HTML</type>
           </language>
</computer>

The XSL:

  <xsl:template match="computer">
  [<span class="skills">
                       <xsl:apply-templates select="language">
                           <xsl:sort select="@rank" order="ascending"/>
                       </xsl:apply-templates>
                   </span>]
</xsl:template>

The output now is in the same order as it is in the order of the
document w= hen the @rank value is 1, and followed by the one where
@rank=2.

[XML 1.0] [XSLT 1.0] [HTML 4.01/XHTML 1.0] [CSS] [XSLT 2.0].

Is it possible that I can get it to display as

[CSS] [HTML 4.01/XHTML 1.0] [XML 1.0] [XSLT 1.0] [XSLT 2.0]

?

Thanks to those who can help.



Alice Wei
MIS 2008
School of Library and Information Science Indiana University
Bloomington ajwei(_at_)indiana(_dot_)edu
812-856-2659


--~------------------------------------------------------------------
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>
--~--


--~------------------------------------------------------------------
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>
--~--





Alice Wei
MIS 2008
School of Library and Information Science
Indiana University Bloomington
ajwei(_at_)indiana(_dot_)edu
812-856-2659


--~------------------------------------------------------------------
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>