DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25442>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25442

Invalid results from xsl:attribute with Docbook XHTML transform

           Summary: Invalid results from xsl:attribute with Docbook XHTML
                    transform
           Product: XalanJ2
           Version: 2.5Dx
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan.processor
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


There seems to be a bug in the processing of xsl:attribute that is triggered by
the TOC production of docbook-xsl-1.62.0/xhtml/docbook.xsl.

Both versions 2.5.D1 and 2.5.2 would appear to give identical results.

The part of the stylesheet autotoc.xsl that relates to this is as follows:

<xsl:template name="toc.line">
  <xsl:param name="toc-context" select="."/>
  <xsl:param name="depth" select="1"/>
  <xsl:param name="depth.from.context" select="8"/>

 <span>
  <xsl:attribute name="class"><xsl:value-of select="local-name(.)"/></xsl:attribute>
  <a>
    <xsl:attribute name="href">
      <xsl:call-template name="href.target">
        <xsl:with-param name="context" select="$toc-context"/>
      </xsl:call-template>
    </xsl:attribute>
    ...
  </a>
 </span>
</xsl:template>

Usually this gives the expected 
<span class="sect1"><a href="whatever">Text</a></span>, 
but in the first sect1 of any chapter and in the first sect2 of that sect1 the
result is 
<span =""><a href="whatever">Text</a></span>

That is, both the name and value of the attribute have vanished.
Changing the element declarations from <span> and <a> to <xsl:element
name="span"> and <xsl:element name="a"> makes no difference.

Furthermore, if the span is removed altogether, the result is 
<a ="">Text</a>

Wrapping the span in a <div type="span"> (stated with xsl:attribute) produces
<div =""><span class="sect1"><a href="whatever">Text</a></span></div>

Using a plain <div> without an attribute results in 
<div><span =""><a href="whatever">Text</a></span></div>

Adding additional attributes to the element shows that the problem only affects
the first attribute: 

  <xsl:attribute name="b-class"><xsl:value-of
select="local-name(.)"/></xsl:attribute>
  <xsl:attribute name="class"><xsl:value-of select="local-name(.)"/></xsl:attribute>

gives <span ="" class="sect1">

So, somehow the first call to <xsl:attribute> for the first element on any given
level seems to get bogus results. Since the result is not even legal XML, I
would assume this to be a problem in Xalan.

Any ideas?

Reply via email to