When you want to use the greater than and less than you can't use the "<" and ">" signs. You have to use the "<" and ">" like you have done a couple of times, but not everywhere. Try changing this and see if the XSLT still generates errors.
I think the problem is that either the first or the second if statement is used but i have to use both. For position 1-2 top-sub-1 and for position > 2 top-sub-2
It makes sense that it only hits the first if sentence since it returns all the nodes that do have children and therefore the 2. if is never hit. Therefore please try to switch them around if you have not done so already.
Otherwise try making a choose instead like
<xsl:choose> <xsl:when test="your count that checks between 2 and 15"><!--code here--></xsl:when> <xsl:when test="your count that checks if greater than 0"><!--code here--></xsl:when> </xsl:choose>
In the above example I have made the switch I'm talking about since I'm 100% sure that in a choose you will not come to the next when if the first one met is true. So if you started with the greater than 0 condition it would never go to the next check.
I think the problem is that position is a static number. So if i will search for all items for example the number would be 9. So it is only using the top-sub-2 because it is between 2 and 15
But it should use only another div box for the first two items 1-2 which are then not displayed in top-sub-2
Maybe this would be a lot easier if you add two properties of true/false to your master document type called "display in box 1" and "display in box 2".
That way you can make a check on these properties to decide, which nodes should be displayed where. The above posted code looks way to cumbersome for what youo're trying to achieve.
I think this could be a pragmatic solution to your problem. However I'm not able to provide you with some examples at the moment. Need to wake up first ;-)
Ok, in that case it makes sense that you're trying to do it by counting etc.
If I have some spare time this evening I'll try to dig deeper into it.
It's much easier to just say that you need the pages with property x set in box 1 and those with property y set in box 2 instead of having to count etc. - You can also do it using a textbox. I just find it more easy to use booleans when it's in fact that you're testing for. But since the suggestion is probably not a solution for you it does not matter :-)
Navigation count problem
Hello
Is it possible to count the items inside a navigation?
I need different <div> blocks for some items.
So it should be
for < 8 items
-- <div id="test1">
for > 8 < 16 items
-- <div id="test2">
But everytime i try this there is an error inside my xslt file saying that the div is not allowed.
Can somebody help?
You'll probably need to post your xslt. Also make sure you are closing you div tag. But yes counting is definetly possible.
Ok here it is:
This does not work properly. Another problem is that in the top-sub-2 menu the items which are in top-sub-1 menu should not appear.
Post your complete xslt cause it's not clear where you start from (where's current() coming from...)
Cheers,
/Dirk
Hi Dominik.
When you want to use the greater than and less than you can't use the "<" and ">" signs. You have to use the "<" and ">" like you have done a couple of times, but not everywhere. Try changing this and see if the XSLT still generates errors.
/Kim A
I didnt get this working.
So what i want to do:
I have a navigation inside a div for 7 items. After 7 items there should be a new div (with a new class)
In this way:
Can anybody help?
Hey Dominik
What's the rendered output of your code?
I assume that you closed the ul's the right way and not like this: </ul<.
Did you remember to change this line as well:
to this:
/Kim A
Thanks
What the problem is
If i got two arguments the navigation is always using the second if statement.
So i have to ensure that the first items are not overwritten with the second items
If I am using the following code and there are three navigation items there should be the first two inside the <div class="top-sub-1">
and the third one in <div class=top-sub-2> but all three appears in top-sub-2
Hi Dominik
Have you tried changing the order in, which the if statements appear? I think that once the first if is met the other one is never hit...
/Jan
Still the same problem
All items are in the top-sub-2 div
I think the problem is that either the first or the second if statement is used but i have to use both. For position 1-2 top-sub-1 and for position > 2 top-sub-2
But everytime it uses only one if statement
It makes sense that it only hits the first if sentence since it returns all the nodes that do have children and therefore the 2. if is never hit. Therefore please try to switch them around if you have not done so already.
Otherwise try making a choose instead like
<xsl:choose>
<xsl:when test="your count that checks between 2 and 15"><!--code here--></xsl:when>
<xsl:when test="your count that checks if greater than 0"><!--code here--></xsl:when>
</xsl:choose>
In the above example I have made the switch I'm talking about since I'm 100% sure that in a choose you will not come to the next when if the first one met is true. So if you started with the greater than 0 condition it would never go to the next check.
Hope this helps.
/Jan
Hi Jan,
I will try to make a choose.
But in which example you made the switch?
I think the problem is that position is a static number. So if i will search for all items for example the number would be 9. So it is only using the top-sub-2 because it is between 2 and 15
But it should use only another div box for the first two items 1-2 which are then not displayed in top-sub-2
top-sub-2 should only handle items 3-15
here it is inside a choose statement
now i've got a new idea of doing this
I create a own property called "showInSubNaviBox" and set this to left, middle
But now every item is displayed in each box
Hi Dominik
Maybe this would be a lot easier if you add two properties of true/false to your master document type called "display in box 1" and "display in box 2".
That way you can make a check on these properties to decide, which nodes should be displayed where. The above posted code looks way to cumbersome for what youo're trying to achieve.
I think this could be a pragmatic solution to your problem. However I'm not able to provide you with some examples at the moment. Need to wake up first ;-)
/Jan
Where is the difference between Using a textstring or a true/false to decide in which box the Link should appear?
In the future there is also a box 3 and box 4 so i do not want to have 4 different properties.
Thanks
Hi Dominik
Ok, in that case it makes sense that you're trying to do it by counting etc.
If I have some spare time this evening I'll try to dig deeper into it.
It's much easier to just say that you need the pages with property x set in box 1 and those with property y set in box 2 instead of having to count etc. - You can also do it using a textbox. I just find it more easy to use booleans when it's in fact that you're testing for. But since the suggestion is probably not a solution for you it does not matter :-)
I'll keep you posted.
/Jan
Thanks for your help
but why it does not work to use a textstring to decide in which box the link will appear.
In this case i can use a property dropdown in the documet type with values "box1" "box2" "box3" etc.
The XSLT has to check if the menupoint uses "box1" as value and put this point under the div container "top-sub-1"
is working on a reply...