You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by cr...@apache.org on 2002/06/07 06:17:32 UTC

cvs commit: xml-forrest/src/resources/library/xslt docv10todocv11.xsl filterlinks.xsl

crossley    2002/06/06 21:17:32

  Modified:    src/resources/library/xslt docv10todocv11.xsl
                        filterlinks.xsl
  Log:
  Fix dos2unix.
  
  Revision  Changes    Path
  1.4       +97 -97    xml-forrest/src/resources/library/xslt/docv10todocv11.xsl
  
  Index: docv10todocv11.xsl
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/resources/library/xslt/docv10todocv11.xsl,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- docv10todocv11.xsl	4 Jun 2002 21:35:57 -0000	1.3
  +++ docv10todocv11.xsl	7 Jun 2002 04:17:32 -0000	1.4
  @@ -1,97 +1,97 @@
  -<?xml version="1.0" encoding="UTF-8"?>
  -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  -
  -  <!-- document-v10.dtd to document-v11.dtd transformation -->
  -  
  -  <!-- normally, I would include something like this:
  -  <xsl:output doctype-public="-//APACHE//DTD Documentation V1.1//EN" doctype-system="document-v11.dtd"/>
  -  We should something similar, i.e. make sure the result of this transformation is validated against the v11 DTD
  -  -->
  -  
  -  <xsl:template match="/">
  -    <xsl:choose>
  -      <xsl:when test="document">
  -        <!-- there exists a document element -->
  -        <xsl:apply-templates/>
  -      </xsl:when>
  -      <xsl:otherwise>
  -        <!-- no document element, presumably no header also, so I will generate one -->
  -        <document>
  -          <header>
  -            <title><xsl:value-of select="s1[1]/@title"/></title>
  -            <authors><person name="unknown" email="unknown"/></authors>
  -          </header>
  -          <body>
  -            <xsl:choose>
  -              <xsl:when test="count(s1)='1'">
  -                <!-- only one s1 in the entire document, must be a hack to create a title -->
  -                <xsl:choose>
  -                  <xsl:when test="count(s1/s2)='1'">
  -                    <!-- only one s2 inside that s1, unwrap the content of that s2 -->
  -                    <xsl:apply-templates select="s1/s2/*"/>
  -                  </xsl:when>
  -                  <xsl:otherwise>
  -                    <!-- in any case, we get rid of these s1/s2 elements -->
  -                    <xsl:apply-templates select="s1/*"/>
  -                  </xsl:otherwise>
  -                </xsl:choose>
  -              </xsl:when>
  -              <xsl:otherwise>
  -                <xsl:apply-templates/>
  -              </xsl:otherwise>
  -            </xsl:choose>
  -          </body>
  -        </document>
  -      </xsl:otherwise>
  -    </xsl:choose>
  -  </xsl:template>
  -  
  -  <!-- no links allowed in em anymore -->
  -  <xsl:template match="em[link]">
  -    <xsl:apply-templates/>
  -  </xsl:template>
  -
  -  <!-- fixes sections -->
  -  <xsl:template match="s1 | s2 | s3 | s4">
  -    <section>
  -      <xsl:for-each select="@*">
  -        <xsl:copy-of select="."/>
  -      </xsl:for-each>
  -      <xsl:apply-templates/>
  -    </section>
  -  </xsl:template>
  -
  -  <!-- dunnow what to do with connect - maybe just evaporize it? -->
  -  <xsl:template match="connect">
  -    <xsl:message terminate="no">The connect element isn't supported anymore in the document-v11.dtd, please fix your document.</xsl:message>
  -    [[connect: <xsl:value-of select="."/> ]]
  -  </xsl:template>
  -
  -  <xsl:template match="link/@idref">
  -    <xsl:message terminate="no">The link element has no idref attribute defined in the document-v11.dtd, please fix your document.</xsl:message>
  -    [[link/@idref: <xsl:value-of select="."/> ]]
  -  </xsl:template>
  -
  -  <xsl:template match="link/@type | link/@actuate | link/@show |
  -                       jump/@type | jump/@actuate | jump/@show |
  -                       fork/@type | fork/@actuate | fork/@show"/>
  -
  -  <!-- 'simple lists' become unordered lists -->
  -  <xsl:template match="sl">
  -    <ul>
  -      <xsl:for-each select="@*">
  -        <xsl:copy-of select="."/>
  -      </xsl:for-each>
  -      <xsl:apply-templates/>
  -    </ul>
  -  </xsl:template>
  -
  -  <!-- the obligatory copy-everything -->
  -  <xsl:template match="node() | @*">
  -    <xsl:copy>
  -      <xsl:apply-templates select="@*"/>
  -      <xsl:apply-templates/>
  -    </xsl:copy>
  -  </xsl:template>
  -
  -</xsl:stylesheet>
  +<?xml version="1.0" encoding="UTF-8"?>
  +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  +
  +  <!-- document-v10.dtd to document-v11.dtd transformation -->
  +  
  +  <!-- normally, I would include something like this:
  +  <xsl:output doctype-public="-//APACHE//DTD Documentation V1.1//EN" doctype-system="document-v11.dtd"/>
  +  We should something similar, i.e. make sure the result of this transformation is validated against the v11 DTD
  +  -->
  +  
  +  <xsl:template match="/">
  +    <xsl:choose>
  +      <xsl:when test="document">
  +        <!-- there exists a document element -->
  +        <xsl:apply-templates/>
  +      </xsl:when>
  +      <xsl:otherwise>
  +        <!-- no document element, presumably no header also, so I will generate one -->
  +        <document>
  +          <header>
  +            <title><xsl:value-of select="s1[1]/@title"/></title>
  +            <authors><person name="unknown" email="unknown"/></authors>
  +          </header>
  +          <body>
  +            <xsl:choose>
  +              <xsl:when test="count(s1)='1'">
  +                <!-- only one s1 in the entire document, must be a hack to create a title -->
  +                <xsl:choose>
  +                  <xsl:when test="count(s1/s2)='1'">
  +                    <!-- only one s2 inside that s1, unwrap the content of that s2 -->
  +                    <xsl:apply-templates select="s1/s2/*"/>
  +                  </xsl:when>
  +                  <xsl:otherwise>
  +                    <!-- in any case, we get rid of these s1/s2 elements -->
  +                    <xsl:apply-templates select="s1/*"/>
  +                  </xsl:otherwise>
  +                </xsl:choose>
  +              </xsl:when>
  +              <xsl:otherwise>
  +                <xsl:apply-templates/>
  +              </xsl:otherwise>
  +            </xsl:choose>
  +          </body>
  +        </document>
  +      </xsl:otherwise>
  +    </xsl:choose>
  +  </xsl:template>
  +  
  +  <!-- no links allowed in em anymore -->
  +  <xsl:template match="em[link]">
  +    <xsl:apply-templates/>
  +  </xsl:template>
  +
  +  <!-- fixes sections -->
  +  <xsl:template match="s1 | s2 | s3 | s4">
  +    <section>
  +      <xsl:for-each select="@*">
  +        <xsl:copy-of select="."/>
  +      </xsl:for-each>
  +      <xsl:apply-templates/>
  +    </section>
  +  </xsl:template>
  +
  +  <!-- dunnow what to do with connect - maybe just evaporize it? -->
  +  <xsl:template match="connect">
  +    <xsl:message terminate="no">The connect element isn't supported anymore in the document-v11.dtd, please fix your document.</xsl:message>
  +    [[connect: <xsl:value-of select="."/> ]]
  +  </xsl:template>
  +
  +  <xsl:template match="link/@idref">
  +    <xsl:message terminate="no">The link element has no idref attribute defined in the document-v11.dtd, please fix your document.</xsl:message>
  +    [[link/@idref: <xsl:value-of select="."/> ]]
  +  </xsl:template>
  +
  +  <xsl:template match="link/@type | link/@actuate | link/@show |
  +                       jump/@type | jump/@actuate | jump/@show |
  +                       fork/@type | fork/@actuate | fork/@show"/>
  +
  +  <!-- 'simple lists' become unordered lists -->
  +  <xsl:template match="sl">
  +    <ul>
  +      <xsl:for-each select="@*">
  +        <xsl:copy-of select="."/>
  +      </xsl:for-each>
  +      <xsl:apply-templates/>
  +    </ul>
  +  </xsl:template>
  +
  +  <!-- the obligatory copy-everything -->
  +  <xsl:template match="node() | @*">
  +    <xsl:copy>
  +      <xsl:apply-templates select="@*"/>
  +      <xsl:apply-templates/>
  +    </xsl:copy>
  +  </xsl:template>
  +
  +</xsl:stylesheet>
  
  
  
  1.2       +1 -1      xml-forrest/src/resources/library/xslt/filterlinks.xsl
  
  Index: filterlinks.xsl
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/resources/library/xslt/filterlinks.xsl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- filterlinks.xsl	29 May 2002 16:44:55 -0000	1.1
  +++ filterlinks.xsl	7 Jun 2002 04:17:32 -0000	1.2
  @@ -39,4 +39,4 @@
      </xsl:copy>
     </xsl:template>
   
  -</xsl:stylesheet>
  \ No newline at end of file
  +</xsl:stylesheet>