Avatar billede den-evil Nybegynder
29. februar 2008 - 11:51 Der er 1 løsning

sort på navigationstitel?

Hey alle...

Vil gerne have sorteret på min navigations titel, men er lidt i tvivl om hvordan og hvorledes...
--------------------------------------------


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output omit-xml-declaration="yes" encoding="utf-8" method="html" />
 
  <!-- Utility Variables  -->
  <xsl:variable name="selectedMenuItemClass">sel </xsl:variable>
  <!-- Navigation rendering -->
  <xsl:variable name="FilenamePrefix">
    <xsl:value-of select="Navigation/@FilenamePrefix" />
  </xsl:variable>
  <xsl:variable name="FileExtension">
    <xsl:value-of select="Navigation/@FileExtension" />
  </xsl:variable>
  <xsl:variable name="SelectedPageId">
    <xsl:value-of select="Navigation/@PageId" />
  </xsl:variable>
  <xsl:variable name="queryparams">
    <xsl:value-of select="Navigation/RequestContent/ServerVariables/Entry[@Name='QUERY_STRING']" />
  </xsl:variable>
  <xsl:template match="Module">
    <xsl:apply-templates select="Layout" />
  </xsl:template>
  <xsl:template match="Layout">
    <xsl:apply-templates select="Row" />
  </xsl:template>
  <xsl:template match="Row">
    <xsl:apply-templates select="Cell" />
  </xsl:template>
  <xsl:template match="Cell">
    <xsl:value-of select="translate(ContentArea, '&#xD;&#xA;&#xA;    ', '')" disable-output-escaping="yes" />
  </xsl:template>
  <xsl:template match="Navigation">
    <xsl:apply-templates select="NavigationElement[@ShowInNavigation='true']" />
    <br />
  </xsl:template>
 
  <xsl:template match="NavigationElement[@ShowInNavigation='true']">
 
    <xsl:variable name="itemClass">
      <xsl:if test="@Selected='true'">
        <xsl:copy-of select="$selectedMenuItemClass" />
      </xsl:if>
      <xsl:if test="@ChildSelected='true'">
        <xsl:copy-of select="$selectedMenuItemClass" />
      </xsl:if>
    </xsl:variable>
   
    <xsl:if test="not($itemClass='')">
      <xsl:attribute name="class">
        <xsl:copy-of select="normalize-space($itemClass)" />
      </xsl:attribute>
    </xsl:if>
   
    <div class="indholdsnavigationmenu">
        <li>
            <a>
              <xsl:attribute name="href">
                  /<xsl:value-of select="LongUrl" /><xsl:if test="$queryparams != ''"><xsl:text>?</xsl:text><xsl:copy-of select="$queryparams" /></xsl:if></xsl:attribute>
              <xsl:attribute name="title">
                <xsl:value-of select="NavigationTitle" />
              </xsl:attribute>
              <xsl:value-of select="NavigationTitle" />
            </a>
        </li>
    </div>
   
    <xsl:if test="NavigationElement[@ShowInNavigation='true']">
      <xsl:apply-templates select="NavigationElement[@ShowInNavigation='true']" />
    </xsl:if>
   
  </xsl:template>
</xsl:stylesheet>
Avatar billede jokkejensen Novice
11. marts 2008 - 13:05 #1
<xsl:template match="Navigation">
    <xsl:apply-templates select="NavigationElement[@ShowInNavigation='true']" >
<xsl:sort select="LongUrl" data-type="text" ordeR="DESC" />
</xsl:apply-templates>
    <br />
  </xsl:template>

Altså neste en <xsl:sort> ind i din <xsl:applytemplate> hvor du ønsker sorteringen.

/JJ
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester