Steven Noels wrote:
 >>If the output is xhtml would it be reasonable to write an
 >>xslt -> xml and
 >>then back via our (Cocoons) document html look and feel?
 >
 >
 > Output is well-formed, so it should be feasible. Who's volunteering? ;-)

Done. Well, sort of. I copied the image maps and inner tables
for attributes and other stuff through to the xdoc. It's for the
latest forrest DTD BTW.

J.Pietschmann



<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
  
  <xsl:template match="html">
    <document>
      <header>
        <title>Schema</title>
        <version>0.0</version>
        <authors>
          <person name="automatically generated"/>
        </authors>
      </header>
      <body>
        <xsl:apply-templates select="body"/>
      </body>
    </document>
  </xsl:template>

  <xsl:template match="body">
    <section>
      <title>Overview</title>
      <p><xsl:apply-templates select="span[1]/node()"/></p>
      <p><xsl:apply-templates select="span[2]/node()"/></p>
      <xsl:for-each select="table[1]/tr[translate(normalize-space(td[1]),'&#160;','')!='']">
        <p><xsl:apply-templates select="td[1]/node()"/>: <xsl:apply-templates select="td[2]/node()"/></p>
      </xsl:for-each>
      <xsl:for-each select="table[2]">
        <xsl:for-each select="tr[1]/td">
          <xsl:variable name="column" select="position()"/>
          <p>
            <xsl:apply-templates select="node()"/>
            <xsl:text>: </xsl:text>
            <xsl:for-each select="tr[position() &gt; 1][translate(normalize-space(td[$column]),'&#160;','')!='']">
              <xsl:apply-templates select="td[$column]"/>
              <xsl:if test="position()!=last()">
                <xsl:text>, </xsl:text>
              </xsl:if>
            </xsl:for-each>
          </p>
        </xsl:for-each>
      </xsl:for-each>
    </section>
    <section>
      <title>Elements</title>
      <xsl:apply-templates select="a[@name]" mode="generate-element"/>
    </section>
  </xsl:template>

  <xsl:template match="a[@name]" mode="generate-element">
    <section id="{@name}">
      <title>
        <xsl:apply-templates select="following-sibling::span[1]"/>
        <xsl:text>: </xsl:text>
        <xsl:apply-templates select="following-sibling::span[2]"/>
      </title>
      <xsl:for-each select="following-sibling::table[1]/tr">
        <section>
          <title><xsl:apply-templates select="td[1]/node()"/></title>
          <xsl:choose>
            <xsl:when test="td[1]='source' and td[2]//pre">
              <source><xsl:apply-templates select="td[2]/node()"/></source>
            </xsl:when>
            <xsl:otherwise>
              <p><xsl:apply-templates select="td[2]/node()"/></p>
            </xsl:otherwise>
          </xsl:choose>
        </section>
      </xsl:for-each>
    </section>
  </xsl:template>
  
  <xsl:template match="node()|@*">
    <xsl:copy>
      <xsl:apply-templates select="node()|@*"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="a[@href]">
    <link href="{@href}">
      <xsl:apply-templates select="node()|@*"/>
    </link>
  </xsl:template>

  <xsl:template match="source/pre">
    <xsl:apply-templates select="node()"/>
  </xsl:template>

  <xsl:template match="span">
    <xsl:apply-templates select="node()"/>
  </xsl:template>

</xsl:stylesheet>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to