Re: Report stylesheet bug (was: Insert the SQL - Mailing list pgadmin-support

From Dave Page
Subject Re: Report stylesheet bug (was: Insert the SQL
Date
Msg-id 4565C9C9.5030907@postgresql.org
Whole thread Raw
In response to Insert the SQL in the report [not working]  ("Ezequias Rodrigues da Rocha" <ezequias.rocha@gmail.com>)
Responses Re: Report stylesheet bug (was: Insert the SQL  ("Ezequias Rodrigues da Rocha" <ezequias.rocha@gmail.com>)
List pgadmin-support
Ezequias Rodrigues da Rocha wrote:
> I say comments not Report Notes.
>
> Source and Comment are definetly not ok.
>
> See my attached image.

Ahh, sorry - misread your message. After spending an hour or so trying
to figure it out with one of the guys here, I've come to the conclusion
that we simply don't know why it's broken (I'm far from an expert in
XSL). If anyone has an idea, I'm all ears...

The stylesheet can be found at
http://www.pgadmin.org/docs/1.6/default-xsl.html - the problem appears
to be in the last two template, the first of which should call the
second but apparently does not. The second is used for the notes and SQL
at the bottom of the reports so is obviously not totally broken:

<xsl:template match="*" mode="cells">
   <xsl:param name="row" />
     <td class="ReportTableValueCell">
     <xsl:choose>
       <xsl:when test="$row/@*[name() = current()/@id]|$row/*[name() =
current()/@id] != ''">
         <xsl:call-template name="substitute">
           <xsl:with-param name="string" select="$row/@*[name() =
current()/@id]|$row/*[name() = current()/@id]" />
         </xsl:call-template>
       </xsl:when>
       <xsl:otherwise>
         <xsl:text> </xsl:text>
       </xsl:otherwise>
     </xsl:choose>
   </td>
</xsl:template>

<xsl:template name="substitute">
    <xsl:param name="string" />
    <xsl:param name="from" select="'
'" />
    <xsl:param name="to">
       <br />
    </xsl:param>
    <xsl:choose>
       <xsl:when test="contains($string, $from)">
          <xsl:value-of select="substring-before($string, $from)" />
          <xsl:copy-of select="$to" />
          <xsl:call-template name="substitute">
             <xsl:with-param name="string"
select="substring-after($string, $from)" />
             <xsl:with-param name="from" select="$from" />
             <xsl:with-param name="to" select="$to" />
          </xsl:call-template>
       </xsl:when>
       <xsl:otherwise>
          <xsl:value-of select="$string" />
       </xsl:otherwise>
    </xsl:choose>
</xsl:template>

Regards, Dave.

pgadmin-support by date:

Previous
From: Dave Page
Date:
Subject: Re: Insert the SQL in the report [not working]
Next
From: "Ezequias Rodrigues da Rocha"
Date:
Subject: Re: Report stylesheet bug (was: Insert the SQL