[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Re: [xsl] interating through tree structure
Subject: Re: [xsl] interating through tree structure From: Dimitre Novatchev <dnovatchev@xxxxxxxxx> Date: Tue, 31 Mar 2009 06:30:49 -0700 |
> Hopefully someone can help me with something that I thought was going to be straight forward but has been giving me a few problems! > I don't see any code in this message. For generic operations on a tree one can use the FXSL function f:foldl-tree() http://fxsl.cvs.sourceforge.net/viewvc/fxsl/fxsl-xslt2/f/func-foldl-tree.xsl? revision=1.1&view=markup Here is the test for this function: This transformation: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:f="http://fxsl.sf.net/" exclude-result-prefixes="f" > <xsl:import href="../f/func-foldl-tree.xsl"/> <xsl:import href="../f/func-Operators.xsl"/> <!-- This transformation must be applied to: ../data/numTree.xml Expected result: 66 --> <xsl:output method="text"/> <xsl:template match="/"> <xsl:value-of select="f:foldl-tree(f:add(), f:add(), 0, /*)"/> </xsl:template> </xsl:stylesheet> when applied on this XML document: <nums tree-nodeLabel="01"> <num tree-nodeLabel="02">01</num> <num tree-nodeLabel="03">02</num> <num tree-nodeLabel="04">03</num> <num tree-nodeLabel="05">04</num> <num tree-nodeLabel="06">05</num> <num tree-nodeLabel="07">06</num> <num tree-nodeLabel="08">07</num> <num tree-nodeLabel="09">08</num> <num tree-nodeLabel="10">09</num> <num tree-nodeLabel="11">10</num> </nums> produces the wanted result: 66 -- Cheers, Dimitre Novatchev --------------------------------------- Truly great madness cannot be achieved without significant intelligence. --------------------------------------- To invent, you need a good imagination and a pile of junk ------------------------------------- Never fight an inanimate object ------------------------------------- You've achieved success in your field when you don't know whether what you're doing is work or play On Tue, Mar 31, 2009 at 3:18 AM, jim mcgovern <jim_mcgovern@xxxxxxxxxxxxx> wrote: > > Hi there > > Hopefully someone can help me with something that I thought was going to be straight forward but has been giving me a few problems! > > I'm trying to generate site navigation from an xml file which is pretty much as below:- > > > > > > > > > > > > > > > > > > > > > > The above is a snapshot as it can go down "n" levels. B If I'm at page6 then my navigation needs to be:- > > > B dir1 > B dir2 > B dir4 > > > B dir5 > B dir6 > > > What I'm having difficulty with is how to close the opening ul and open a new ul when I'm a directory up from the directory level I'm actully on. > > A stripped down but working version of What I'm trying is:- > > > > > > > > > > > > > > > > > > > > > > > > > > > > Can anyone advise me on how to achieve the formatting where I have 2 sets of ULs? Any pointers much appreciated. > > Jim > _________________________________________________________________ > All your Twitter and other social updates in one place > http://clk.atdmt.com/UKM/go/137984870/direct/01/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] interating through tree struc, jim mcgovern | Thread | Re: [xsl] Re: encoding error when u, Michael Ludwig |
Re: [xsl] Re: encoding error when u, Michael Ludwig | Date | Re: [xsl] AltovaXML and fragment id, Michael Ludwig |
Month |
Keywords