Orlanski: Ausgabe in html Listen

Guten Morgen,

ich hab vor kurzem angefangen mich mit XSL zu beschäftigen. Jetzt stehe ich schon vor dem ersten Problem. Ich will folgende Listen in normale html Listen (ol und ul) transformieren, weiß aber nicht so recht wie.

xml input:

<L>
  <LI>
   <Lbl>-</Lbl>
   <Lbody>
    <Standard>text</Standard>
   </Lbody>
  </LI>
  <LI>
   <Lbl>-</Lbl>
   <Lbody>
    <Standard>mehr text</Standard>
   </Lbody>
  </LI>
  ...
</L>

Standard kann dabei auch außerhalb von Listen vorkommen. Und eine nummerierte Liste wird so angegeben:

<L>
  <LI>
   <Lbl>1.</Lbl>
   <Lbody>
    <Standard>text</Standard>
   </Lbody>
  </LI>
  <LI>
   <Lbl>2.</Lbl>
   <Lbody>
    <Standard>mehr text</Standard>
   </Lbody>
  </LI>
  ...
</L>

Sie unterscheiden sich nur im Lbl. Ich würde ja ne <choose>Anweisung nehmen und Lbl mit contains untersuchen. Hab auch ewig rumprobiert und es kam nichts richtiges dabei raus.

Kann mir da jemand weiterhelfen...

  1. Als Idee

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
        <xsl:output method="html"/>
        <xsl:template match="/">
            <html>
                <head/>
                <body>
                    <xsl:apply-templates select="L"/>
                </body>
            </html>
        </xsl:template>
        <xsl:template match="L">
    <!-- hier könnten abfragen stehet ob ul oder ol benutzt werden soll -->
            <ul>
                <xsl:apply-templates select="LI"/>
            </ul>
        </xsl:template>
        <xsl:template match="LI">
            <li>
                <xsl:apply-templates select="Lbody"/>
            </li>
        </xsl:template>
        <xsl:template match="Lbody">
            <p>
                xsl:apply-templates/
            </p>
        </xsl:template>
    </xsl:stylesheet>

    1. Wen's interessiert, hab ich mal die Abfrage nach ewigen eigentesten gepostet. Danke Holge r, für die Richtung, aber gerade die Abfrage mit contains und wie ich wen anspreche, empfand ich am schwierigsten.

      ...

      <xsl:template match="L">
        xsl:choose
          <xsl:when test="LI[contains(Lbl,'-')]">
            <ul>
             <xsl:apply-templates select="LI"/>
            </ul>
          </xsl:when>
          xsl:otherwise
            <ol>
              <xsl:apply-templates select="LI"/>
            </ol>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:template>

      <xsl:template match="LI">
      <li><xsl:value-of select="Lbody"/></li>
      </xsl:template>

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