Subject: [xsl] xsl-if: hide two navigation-levels From: Ragnar Heil <r@xxxxxxx> Date: Fri, 09 Sep 2005 10:04:19 +0200 |
Hi, I am using a CMS & MS XML4 to generate a navigation The XSLT loops through all existing directories and generates a nice navi, that works Now I want to hide the first two levels. I am showing you some snipplets of my xslt .. <xsl:key name="ParentURI" match="tcm:ListOrganizationalItems/tcm:Item" use="@ParentOrgItemID"/> ... output of my xml: <tcm:ListOrganizationalItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0"><tcm:Item ID="tcm:9-3-4" ParentOrgItemID="tcm:0-9-1" Title="Root" Type="4" Modified="2005-08-04T16:24:55" FromPub="Empty Master" Icon="T4L0P0" PublishPath="/" Dir=""/><tcm:Item ID="tcm:9-5-4" ParentOrgItemID="tcm:9-10-4" Title="CNS" Type="4" Modified="2005-09-08T13:19:19" Icon="T4L0P0" PublishPath="/UCB/Therapy" Dir="CNS"/><tcm:Item ID="tcm:9-6-4" ParentOrgItemID="tcm:9-10-4" Title="Allergy & Respiratory Diseases" Type="4" Modified="2005-09-08T13:19:53" Icon="T4L0P0" PublishPath="/UCB/Therapy" Dir="Allergy"/> So how do I know which node is assigned to which level? The node (Item ID="tcm:9-3-4") with ParentOrgItemID="tcm:0-9-1" is the one next to root and should not be displayed The node (Item ID="tcm:9-5-4") with ParentOrgItemID="tcm:9-10-4" is the one next to root and should also not be displayed Finally I want to see ID="tcm:9-6-4" but dont want to hardcode this ID, just exclude the first navi-levels I thought about something like: <xsl:if test="'ParentURI' != 'tcm:0-9-1'"> best regards, Ragnar PS: Find complete XSLT below <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tcm="http://www.tridion.com/ContentManager/5.0"> <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:key name="ItemURI" match="tcm:ListOrganizationalItems/tcm:Item" use="@ID"/> <xsl:key name="ParentURI" match="tcm:ListOrganizationalItems/tcm:Item" use="@ParentOrgItemID"/> <xsl:template match="tcm:ListOrganizationalItems"> <xsl:element name="HTML"> <xsl:element name="HEAD"> <xsl:element name="STYLE"> --------- CSS - stuff --------- </xsl:element> <xsl:element name="SCRIPT"> ------ Javascript ------------ </xsl:element> </xsl:element> <xsl:apply-templates select="tcm:Item[not(key( 'ItemURI' , @ParentOrgItemID))]"/> </xsl:element> </xsl:template> <xsl:template match="tcm:Item"> <xsl:if test="@Type=4"> <xsl:element name="A"> <xsl:attribute name="ID">x<xsl:value-of select="@ID"/></xsl:attribute> <xsl:attribute name="href">JavaScript:Toggle('<xsl:value-of select="@ID"/>');</xsl:attribute>- </xsl:element> </xsl:if> <xsl:element name="A"> <xsl:attribute name="href"><xsl:value-of select="@PublishPath"/>\<xsl:value-of select="@Dir"/></xsl:attribute> <xsl:value-of select="substring(@Title,4)"/> </xsl:element> <xsl:element name="div"> <xsl:attribute name="class">line</xsl:attribute> </xsl:element> <xsl:if test="@Type=4"> <xsl:element name="DIV"> <xsl:attribute name="ID"><xsl:value-of select="@ID"/></xsl:attribute> <xsl:if test="count(key( 'ParentURI' , @ID)) > 0"> <xsl:element name="UL"> <xsl:apply-templates select="key( 'ParentURI' , @ID)"/> </xsl:element> </xsl:if> </xsl:element> </xsl:if> </xsl:template> </xsl:stylesheet>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Grouping by shift problem, Jarno.Elovirta | Thread | Re: [xsl] xsl-if: hide two navigati, Ragulf Pickaxe |
RE: [xsl] Grouping by shift problem, Jarno.Elovirta | Date | Re: [xsl] Apply-templates - how to , David Carlisle |
Month |