Re: [xsl] recursions?

Subject: Re: [xsl] recursions?
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 21 Jun 2001 17:52:18 +0100
At 06:27 PM 6/20/01, Jeni wrote:
Hi Dennis....
If you're producing text, on the other hand, then the easiest way to
achieve the indentation is to pass down a 'indent' parameter from
template to template....

Another easiest way is to use our good friend, the much-maligned but faithful xsl:for-each, as in


<xsl:template match="group">
  <xsl:for-each select="ancestor::group">
    <xsl:text>   </xsl:text>
  </xsl:for-each>
  <xsl:text>GROUP-LEVEL&#xA;<xsl:text>
  <xsl:apply-templates/>
</xsl:template>

and do the same in the template matching "field" to get them indented too. (Put the for-each in a named template if you have to use it alot.)

This would work, wouldn't it Jeni? It's kind of a refinement of the count(ancestor::*) technique.

Cheers,
Wendell


====================================================================== 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



Current Thread