xsl-list
[Top] [All Lists]

Re: table sort

2003-04-25 04:05:06

<David(_dot_)Pawson(_at_)rnib(_dot_)org(_dot_)uk> wrote in message
news:9B66BBD37D5DD411B8CE00508B69700F049E1705(_at_)pborolocal(_dot_)rnib(_dot_)org(_dot_)uk(_dot_)(_dot_)(_dot_)
Given a simple table like the one below,
I need to copy it, with the content sorted by the first entry.

I *thought* it should work using an identity stylesheet,

with

<xsl:template match="tbody">
  <tbody>
   <xsl:apply-templates>
    <xsl:sort select="row/entry[1]/para"/>
   </xsl:apply-templates>
  </tbody>
</xsl:template>

but it only works with
   <xsl:sort/>


Hi Dave,

Probably you wanted:

<xsl:template match="tbody">
  <tbody>
   <xsl:apply-templates>
    <xsl:sort select="entry[1]/para"/>
   </xsl:apply-templates>
  </tbody>
</xsl:template>

Note that the value of the sort key is calculated relative to the selected
node. A "row" does not have a "row" child.



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



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