title: convert xhtml to wiki syntax using xslt
body: <p>i would like to <strong>convert xhtml to dokuwiki syntax using xslt</strong>.</p>
  
  <p>now, one thing i can not seem to work my head around is how to handle nested lists. the dokuwiki syntax uses an asterisk (*) for a list item which is prepended by two white spaces per nesting level (c.f. <a href="http://www.dokuwiki.org/syntax#lists" rel="nofollow noreferrer">wiki syntax</a>).</p>
  
  <p><strong>my question:</strong> in the following example, how can the <strong>&lt;xsl:template mach="li"></strong> that matches the list <strong>item 2.1.1</strong> be aware of it's <strong>nesting level</strong>, in order to prepend the right amount of white spaces?</p>
  
  <pre><code>* list item 1
  * list item 2
    * list item 2.1
      * list item 2.1.1
    * list item 2.2
    * list item 2.3
  * list item 3
  </code></pre>
  
  <p>corresponds to</p>
  
  <ul>
  <li>list item 1</li>
  <li>list item 2
  
  <ul>
  <li>list item 2.1
  
  <ul>
  <li>list item 2.1.1</li>
  </ul></li>
  <li>list item 2.2</li>
  <li>list item 2.3</li>
  </ul></li>
  <li>list item 3</li>
  </ul>
  
  <p>which is how the following html is displayed:</p>
  
  <pre><code>&lt;ul&gt;
      &lt;li&gt;
          list item 1
      &lt;/li&gt;
      &lt;li&gt;
          list item 2
          &lt;ul&gt;
              &lt;li&gt;
                  list item 2.1
                  &lt;ul&gt;
                      &lt;li&gt;list item 2.1.1&lt;/li&gt;
                  &lt;/ul&gt;
              &lt;/li&gt;
              &lt;li&gt;list item 2.2&lt;/li&gt;
              &lt;li&gt;list item 2.3&lt;/li&gt;
          &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;
          list item 3
      &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>