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(_at_)sil(_dot_)org> 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