[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Re: Flat -> Hierarchy --- Continue

Subject: RE: Re: Flat -> Hierarchy --- Continue
From: Dongling Ding <dling61@xxxxxxxxx>
Date: Thu, 29 May 2003 10:10:24 -0700 (PDT)
calling hierarchy example
Hi Lars,

I tried to use the recursive way to generate hierarchy
structure. The example I have is to generate hierarchy
by recursively call template itself without looking at
if it's sibling or child. So the structure would be:

<A>
   <B>
      <C/>
    </B>
</A>

However, my case is when I get a node I have to look
at another table(the list of nodes containing parent
and child elements) to see if this node is sibling or
child.


<xsl:template match="/doc">

 <xsl:call-template name="level">
  <xsl:with-param name="node" select="/doc/Node[1]"/>
 </xsl:call-template>

</xsl:template>


<xsl:template name="level">
        <xsl:param name="node"/>

 <xsl:variable name="n"
select="normalize-space($node)"/>
 <xsl:element name="{$n}">

  <xsl:if test="$node/following::Node">
 ***** Here I have to look at another set of
 **** elements   
****   to decide if the current node is seiling or ***
  child. If it is seiling, not call the template.

   <xsl:call-template name="level">
   <xsl:with-param name="node"
select="$node/following::Node"/>
   </xsl:call-template>

  </xsl:if>

 </xsl:element>

</xsl:template>


So, how can I look at another set of elments. Or just
like call a function with two parameters and return
value is boolean in XSLT?


Thanks

Dongling




--- Lars Huttar <lars_huttar@xxxxxxx> wrote:
> Dongling Ding wrote:
> 
> > I think there were some discussion about this
> topic
> > already. But my case is a little different from
> > others. I have a flat structure that need to be
> > converted into a hierarchy based on another set of
> > elements that define the relationship between
> > members.
> > 
> > 
> > I tried to use recursive and xsl:key methods and
> it
> > seems like both of the two methods couldn't solve
> > the
> > problem.
> > 
> > I am wondering if anyone has an idea on this
> > particular case. Any help would be very
> appreciated!
> 
> In what way did your recursive and xsl:key methods
> fail
> to solve the problem?
> That might help us come up with a solution without
> having
> to think the problem through from scratch.
> 
> Lars
> 
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.