This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
indenting text with <dl> and <dd> hack
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] indenting text with <dl> and <dd> hack
- From: Dan Diebolt <dandiebolt at yahoo dot com>
- Date: Thu, 29 Mar 2001 00:46:24 -0800 (PST)
- Reply-To: xsl-list at lists dot mulberrytech dot com
I am trying to use the <dl> and <dd> hack to generated indented
html. This is my xml:
<indent>
<a>Item1.0</a>
<a>Item1.1</a>
<a>Item1.2
<a>Item1.2.1</a>
<a>Item1.2.2</a>
<a>Item1.2.3</a>
</a>
<a>Item1.3</a>
<a>Item1.4
<a>Item1.4.1</a>
<a>Item1.4.2</a>
</a>
</indent>
This is what I want as html output:
<dl>
<dd>Item1.0</dd>
<dd>Item1.1</dd>
<dd>Item1.2</dd>
<dl>
<dd>Item1.2.1</dd>
<dd>Item1.2.2</dd>
<dd>Item1.2.3</dd>
</dl>
<dd>Item1.3</dd>
<dd>Item1.4</dd>
<dl>
<dd>Item1.4.1</dd>
<dd>Item1.4.2</dd>
</dl>
</dl>
I am having a problem in the early placement of the end tags </dl>.
Here is the template I have been working with:
<xsl:template match="a">
<xsl:choose>
<xsl:when test="count(preceding-sibling::*)=0">
<dl>
<dd>
<xsl:value-of select="text()"/>
</dd>
<xsl:apply-templates select="a"/>
</dl>
</xsl:when>
<xsl:otherwise>
<dd>
<xsl:value-of select="text()"/>
</dd>
<xsl:apply-templates select="a"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Any help would be appreciated.
__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/?.refer=text
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list