Re: [xsl] indenting text with <dl> and <dd> hack

Subject: Re: [xsl] indenting text with <dl> and <dd> hack
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 29 Mar 2001 13:53:57 +0100
Hi Dan,

It looks from the samples that you sent as if there are two types of
'a' elements - ones that contain subelements (other 'a' elements) and
ones that don't.  The ones that don't just need to be turned into 'dd'
elements:

<xsl:template match="a[not(a)]">
   <dd><xsl:value-of select="." /></dd>
</xsl:template>

The ones that *do* contain subelements need the initial text to be
turned into a 'dd' element, and then the 'a' subelements to be given
within a 'dl' element:

<xsl:template match="a[a]">
   <dd><xsl:value-of select="normalize-space(text())" /></dd>
   <dl>
      <xsl:apply-templates select="a" />
   </dl>
</xsl:template>

And of course you need the indent element to be turned into a 'dl'
element:

<xsl:template match="indent">
   <dl><xsl:apply-templates /></dl>
</xsl:template>

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/



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


Current Thread