You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sb...@apache.org on 2001/08/06 15:22:49 UTC

cvs commit: xml-xalan/test/tests/bugzilla Bugzilla3001.out Bugzilla3001.xml Bugzilla3001.xsl

sboag       01/08/06 06:22:49

  Added:       test/tests/bugzilla Bugzilla3001.out Bugzilla3001.xml
                        Bugzilla3001.xsl
  Log:
  Test for http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3001.
  
  Revision  Changes    Path
  1.1                  xml-xalan/test/tests/bugzilla/Bugzilla3001.out
  
  Index: Bugzilla3001.out
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <html xmlns="http://www.w3.org/TR/REC-html40">
    <head>
      <title>My Title</title>
    </head>
    <body><a xmlns:html="http://www.w3.org/TR/REC-html40" name="prefix_1"/>
      <div>
        <div>
          <table>
            <tr>
              <td>
                <h1>My Title</h1>
              </td>
            </tr>
          </table>
        </div>
      </div>
    </body>
  </html>
  
  
  1.1                  xml-xalan/test/tests/bugzilla/Bugzilla3001.xml
  
  Index: Bugzilla3001.xml
  ===================================================================
  <?xml version="1.0" ?>
  <html xmlns="http://www.w3.org/TR/REC-html40">
    <head>
      <title>My Title</title>
    </head>
    <body>
      <div>
        <div>
          <table>
            <tr>
              <td>
                <h1><a name="prefix_1">My Title</a></h1>
              </td>
            </tr>
          </table>
        </div>
      </div>
    </body>
  </html>
  
  
  
  1.1                  xml-xalan/test/tests/bugzilla/Bugzilla3001.xsl
  
  Index: Bugzilla3001.xsl
  ===================================================================
  <?xml version="1.0" encoding='iso-8859-1'?>
  
  <!-- this stylesheet looks the first a element (html anchor) whose
       name attribute starts with the string 'prefix_', then copies this
       anchor to the beginning of the document (right after the body
       start tag) and removes the anchor element from the original
       place. the rest of the input is copied identically. -->
  
  <xsl:stylesheet version="1.0" 
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:html="http://www.w3.org/TR/REC-html40" >
  
    <xsl:template match="@*|node()">
      <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
      </xsl:copy>
    </xsl:template>
  
    <xsl:template name="beginning-of-body" >
      <xsl:variable name="first-anchor" select="//html:a[starts-with
  (@name, 'prefix_')][1]/@name" />
      <xsl:if test="$first-anchor" >
        <a name="{$first-anchor}" />
      </xsl:if>
    </xsl:template>
  
    <xsl:template match="//html:a[starts-with(@name, 'prefix_')][not
  (preceding::html:a[starts-with(@name, 'prefix_')])]" > 
      <xsl:apply-templates select="node()" />
    </xsl:template>
  
    <xsl:template match="html:body" >
      <xsl:copy>
        <xsl:call-template name="beginning-of-body" />
        <xsl:apply-templates select="@*|node()" />
      </xsl:copy>
    </xsl:template>
  
  </xsl:stylesheet>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org