Developer forum

Forum » Templates » xslt

Reply

Hi!

 

I'm making a menu in xslt where the (foldout) sub menues have different color according to wich topmenu was choosen.

something like this:

 

top1

    sub1_1

    sub1_2

top2

    sub2_1

    sub2_1

 

sub1_1, sub1_2 are blue

sub2_1,sub2_2 are red

 

I'm able to do this with an if structure testing their Settings/Pageview ID

 

<xsl:if test="Settings/Pageview[@ID='17']">

<!-- make submenues blue-->

.

.

</xsl:if>

 

<xsl:if test="Settings/Pageview[@ID='18']">

<!-- make submenues red-->

.

.

</xsl:if>

 

But I would like them to keep their color after selecting a sub menu, but in the xml there seems to be no memory of their parent ID.

Do you have any suggestions how I could achive this?

Or is it even possible?

 

Can I use the AreaID for this?

 

-jan

 


Replies

 
Nicolai Høeg Pedersen
Reply
jan@magentamultimedia.no wrote:

Hi!

 

I'm making a menu in xslt where the (foldout) sub menues have different color according to wich topmenu was choosen.

something like this:

 

top1

    sub1_1

    sub1_2

top2

    sub2_1

    sub2_1

 

sub1_1, sub1_2 are blue

sub2_1,sub2_2 are red

 

I'm able to do this with an if structure testing their Settings/Pageview ID

 

<xsl:if test="Settings/Pageview[@ID='17']">

<!-- make submenues blue-->

.

.

</xsl:if>

 

<xsl:if test="Settings/Pageview[@ID='18']">

<!-- make submenues red-->

.

.

</xsl:if>

 

But I would like them to keep their color after selecting a sub menu, but in the xml there seems to be no memory of their parent ID.

Do you have any suggestions how I could achive this?

Or is it even possible?

 

Can I use the AreaID for this?

 

-jan

 

Hi Jan
 

 

AreaID makes no sense, since all the items in the XML is from the same area. The path of the navigation is marked with parameter InPath="True" which you can use.

 
Reply

 

 

Hi Jan
 

 

AreaID makes no sense, since all the items in the XML is from the same area. The path of the navigation is marked with parameter InPath="True" which you can use.

 

 

 


 

Hi

thanks for the quick reply

 

 

Yes, but it doesen't tell me which ID its parent is.

I think I have to solve it using several paragraph setups and menus, one for each top node. messy but it works..

Would be nicer to keep all the menu stuff in one xslt

 

cheers

-jan

 
Nicolai Høeg Pedersen
Reply

 

No - you can ask for the parentnode or something like Page[@InPath='True' AND @ID='13'] or something like that - its possible...
 

 
Reply

Can't you just use ../@ID in your xPath ?

 

// Sebastian

 
Reply

Hi again!

 

The ID is just the current ID, not its parent ID.

 

I have looked at the xml output and there is no information about the parentID.

 

The top node are treated as a separate menu from level 1 to level 1

the subnodes level 2-level 2, maby that's why there is no history after pressing a subnode?

 

Would be cool if Icould just step backwards with ../@ID

 

-jan

 

 
Reply

Then I must have misunderstood something.

 

If there is no parent node, how can you create a foldout menu ?

 

// Sebastian

 
Reply
Dammark wrote:

Then I must have misunderstood something.

 

If there is no parent node, how can you create a foldout menu ?

 

// Sebastian


 

Hi!

 

Sorry, my mistake..

I was thinking that since level 2 menues are generated from page siblings they had parent id's form their parent pages.

I can see now that from the point of veiw of the menues, the submenues have no parent id.

 

I'll look into making a true foldout menu instead and see if that doesen't help :)

 

thanks for all the help

 

-jan

 

You must be logged in to post in the forum