Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Sorting with Muenchian Method

From: p.lepin@-------.---
To: NULL
Date: 11/3/2006 6:07:00 AM


aleksander.hansen@g... wrote:
> Hello, I have xml data that I need to group and sort. I
> have tried grouping it using the Muenchian Method.
> Probably not solved the best way, but it works. But I
> can't get the sorting right.

Funny, I don't see any <xsl:sort>s in your transformation.
Precisely how were you trying to get the sorting right?

[XML]

I wonder who designed that...

<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml"/>
  <xsl:key name="k" match="article"
    use="field[@name='KANAL']/category/@path"/>
  <xsl:template match="/">
    <result>
      <xsl:apply-templates
        select=
        "
          //article
          [
            generate-id()=
            generate-id
            (
              key('k',field[@name='KANAL']/category/@path)
            )
          ]
        " mode="channel">
        <xsl:sort
          select="field[@name='KANAL']/category/@id"/>
      </xsl:apply-templates>
    </result>
  </xsl:template>
  <xsl:template match="article" mode="channel">
    <channel>
      <xsl:attribute name="path">
        <xsl:value-of
          select="field[@name='KANAL']/category/@path"/>
      </xsl:attribute>
      <xsl:apply-templates
        select=
        "
          //article
          [
            field[@name='KANAL']/category/@id=
            current()/field[@name='KANAL']/category/@id
          ]
        " mode="program">
        <xsl:sort
          select=
          "
            field[@name='SCHEDULE']/schedule/@startTime
          "/>
      </xsl:apply-templates>
    </channel>
  </xsl:template>
  <xsl:template match="article" mode="program">
    <program>
      <xsl:value-of select="field[@name='TITTEL']"/>
      <xsl:text> - </xsl:text>
      <xsl:value-of
        select=
        "
          field[@name='SCHEDULE']/schedule/@startTime
        "/>
    </program>
  </xsl:template>
</xsl:stylesheet>

-- 
Pavel Lepin



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent