Re: [xsl] XHTML -to- WIKI ... so close ... yet not close enough

Subject: Re: [xsl] XHTML -to- WIKI ... so close ... yet not close enough
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Sun, 06 Feb 2005 20:00:35 +0100
Tempore 12:58:13, die 02/06/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Alan Williamson <alan@xxxxxxxxxxxxx>:

I am wishing to take XHTML to Wiki format. The Wiki format is relatively straight forward with no major complications. I have written most of the XSLT file but I am having problems (fun?) with working with embedded lists.

   <li>Element 3</li>
Should be converted to:

- Element1
- Element2
-- Element2.1
--- Element2.1.1
- Element3


I'm always happy to help spreading the Wiki thought:)

Just in case you should prefer 1 stage transformations, here's another solution:

<xsl:stylesheet xmlns:xsl=""; version="1.0">
<xsl:output method="text"/>

<xsl:template match="li">
	<xsl:for-each select="ancestor::ul">-</xsl:for-each>
	<xsl:text> </xsl:text>

<xsl:template match="text()">
	<xsl:value-of select="normalize-space(.)"/>


Have fun...

Joris Gillis (
Spread the wiki (

Current Thread