What would be the best design for a flexible and unlimited menu tree with XML?
Now I have an XML file with only one type of tag (<item>)
The tag holds the name of the item and possible subitems.
I've built it this way so that it would be unlimited in depth, e.g. :
(If you're interested in the menubuilder, see [URL unfurl="true"]http://www.saulmade.nl/contextMenu/[/URL] and its thread on [URL unfurl="true"]http://forum.echoechoplus.com/showthread.php?s=&threadid=7807[/URL])
But now I have problems regenerating the tree out of the XML file.
I want the items on each level to have a differnt fontSize and indent (Like the original tree on [URL unfurl="true"]http://www.saulmade.nl/contextMenu/[/URL])
So can an XSLT file be used for this?
Can an XSLT file generate a fontsize and marginLeft style property depending on the depth of an item ( = XML node) ?
And can those properties be limited to a certain value, e.g can the XSLT file check if the generated fontsize is larger than a specified value or set it to that value when it was smaller. (like if(x < value){x = value})
(And as an extra, can a different image be assigned depending whether or not the item contans subitems?)
So can someone help me with the xslt file or is there another way to do this?
Thanks
Now I have an XML file with only one type of tag (<item>)
The tag holds the name of the item and possible subitems.
I've built it this way so that it would be unlimited in depth, e.g. :
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<menu>
. <item>
. . treeHead 1
. . <item>treeSub 1.1</item>
. . <item>
. . . treeSub 1.2
. . . <item>treeSub 1.2.1</item>
. . . <item>treeSub 1.2.2</item>
. . </item>
. . <item>treeSub 1.3</item>
. . <item>treeSub 1.4</item>
. </item>
. <item>
. . treeHead 2
. . <item>
. . . treeSub 2.1
. . . <item>
. . . . treeSub 2.1.1
. . . . <item>
. . . . . treeSub 2.1.1.1
. . . . . <item>treeSub 2.1.1.1.1</item>
. . . . </item>
. . . </item>
. . </item>
. </item>
</menu>
(If you're interested in the menubuilder, see [URL unfurl="true"]http://www.saulmade.nl/contextMenu/[/URL] and its thread on [URL unfurl="true"]http://forum.echoechoplus.com/showthread.php?s=&threadid=7807[/URL])
But now I have problems regenerating the tree out of the XML file.
I want the items on each level to have a differnt fontSize and indent (Like the original tree on [URL unfurl="true"]http://www.saulmade.nl/contextMenu/[/URL])
So can an XSLT file be used for this?
Can an XSLT file generate a fontsize and marginLeft style property depending on the depth of an item ( = XML node) ?
And can those properties be limited to a certain value, e.g can the XSLT file check if the generated fontsize is larger than a specified value or set it to that value when it was smaller. (like if(x < value){x = value})
(And as an extra, can a different image be assigned depending whether or not the item contans subitems?)
So can someone help me with the xslt file or is there another way to do this?
Thanks