Subject:XSLT to Html problems Author:Liam B Date:18 Dec 2008 04:45 AM
I'm developing some online organisation charts for my company.
The problem i have is these charts can be very wide with a lot of horizontal scrolling going on. I want to reduce the amount of scrolling by creating groups when a supervisor has a lot of subordinates. When a supervisor has a lot of subordinates i want all those subordinates to be displayed vertically.
When a supervisor one above the lowest level of a department has more than two employees i want to enclose all the subordinates of that supervisor in a group. I've figured the best way of doing that would be instead of each of those subordinates being a table element, i would have all the subordinates in an unordered list with a border round them.
If i've not explained that very well then please let me know. Any halp will be greatly appreciated.
Subject:XSLT to Html problems Author:Liam B Date:18 Dec 2008 06:07 AM
Thanks for the reply Alberto, but i still get exactly the same error.
Broadly speaking though i am following the right path with my XSL?
Basically want i want the XSL to do is loop through every branch of the context node , testing whether or not the last but one node has more than two children. If it does have 2 or more children then i want to execute one block of code, if it has only one child then i want to execute another block.
Subject:XSLT to Html problems Author:(Deleted User) Date:18 Dec 2008 10:05 AM
Hi Liam,
the error could be cause by other occurrence of that expression, the one that end with "=>2]))" in it - it should be "])>=2)".
As for the logic of the test, I am not sure I understand the rationale behind it (why testing the last node only?). Anyhow, you are picking the last node in the descendant axis, and this will always pick exactly the same person (Bez) regardless of where you run the query; this because descendant::Dat_For_Visio contains all the Data_For_Visio elements in the subtree starting from the context node, and [position()=last()] will isolate the deepest one. Maybe you wanted to count the children of the current node? In that case it would be count(child::Data_For_Visio). If you need the count of the total children of the last child of the current node, it would be count(child::Data_For_Visio[position()=last()]/descendant::Data_For_Visio)
Subject:XSLT to Html problems Author:Liam B Date:22 Dec 2008 08:46 AM
Thanks Alberto for your reply, I'm fairly new to XML (and indeed programming so please bear with me!
As regards the logioc of the test, using my example i want to count the children of John Lydon. If John Lydon has more than two employees under him then i want to display those children using an unordered list instead of table elements.
The context node will be the Boss of whichever department i'm producing a chart for. For the sake of brevity i only included a very small department in my example, but i would have to produce charts for some very large departments, as well as one for the the entire organisation.
The nodes i want to perform the test on could be at different levels in the organisation or even the same department. The one constant between them all will be that the people that they supervise will not in turn supervise anybody else. So my test needs to find the very last node, go to it's parent and then count how many children that parent node has.
Subject:XSLT to Html problems Author:(Deleted User) Date:30 Dec 2008 05:20 AM
Hi Liam,
the expression count(descendant::Data_For_Visio[position()=last()]/../child::Data_For_Visio) will return the number of employees under John Lydon.