[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

xsl-if: hide two navigation-levels

Subject: xsl-if: hide two navigation-levels
From: Ragnar Heil <r@xxxxxxx>
Date: Fri, 09 Sep 2005 10:04:19 +0200
xsl hide

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,

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 name="SCRIPT">
          ------  Javascript ------------
      <xsl:apply-templates select="tcm:Item[not(key( 'ItemURI' , @ParentOrgItemID))]"/>
 <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 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 name="div">
               <xsl:attribute name="class">line</xsl:attribute>
    <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)"/>

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.