This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: indenting text with <dl> and <dd> hack
- To: Dan Diebolt <dandiebolt at yahoo dot com>
- Subject: Re: [xsl] indenting text with <dl> and <dd> hack
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Thu, 29 Mar 2001 13:53:57 +0100
- CC: xsl-list at lists dot mulberrytech dot com
- Organization: Jeni Tennison Consulting Ltd
- References: <20010329084624.88510.qmail@web12603.mail.yahoo.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
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