[Home] [By Thread] [By Date] [Recent Entries]
Dmitri,
The easiest way is to do it just the way your Subject line says. To iterate over a set of nodes, use xsl:for-each. Although often abused, for-each is perfect for this kind of thing. So: <xsl:template match="some_node">
<xsl:for-each select="ancestor::component">
<!-- Walking through ancestors named 'component'.
By default, for-each traverses the nodes in document order -->
<xsl:if select="position() > 1">
<!-- add a '/' delimiter in front of all steps but the first one -->
<xsl:text>/</xsl:text>
</xsl:if>
<xsl:value-of select="@name"/>
</xsl:for-each>
</xsl:template>Without xsl:for-each, you'd have to have a special set of templates that walked up (instead of down) the tree, and somehow reversed the order of the values reported. It could be done with a single recursive template. But this solution is easier. Enjoy, Wendell At 11:32 AM 9/13/01, you wrote: I'd like to build a template that gives me "path" of parent nodes for example: ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|

Cart



