Re: [xslt] Output not going to the end ?



Le Fri, Jun 29, 2001 at 08:32:59PM +0200, Raphael Hertzog écrivait:
> I have a very strange problem. One of my stylesheet stop outputing data
> before the end of the transformation. When I use xsltproc -v I see that
> the complete transformation has been done but that not all the data has
> been output.

Nobody answered :-( I really need to get this one fixed, so I'm
volunteering to look into it but I really don't know where to start...
since there's no segfault, no visible error ...

What I can tell you, that might be related, is that the stylesheet uses
a template that catches all text() node and that processes a replacement
of characters by escaped characters for TeX. Something like that :

<xsl:template match="text()">
  <xsl:call-template name="convert2tex">
    <xsl:with-param name="string" select="."/>
  </xsl:call-template>
</xsl:template>

<xsl:template name="replace">
  <xsl:param name="before" select="''"/>
  <xsl:param name="after" select="''"/>
  <xsl:param name="string" select="''"/>

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

<xsl:template name="convert2tex">
  <xsl:param name="string" select="''"/>
  <!-- Convert "\" -> "\(\backslash\)" -->
  <xsl:variable name="after_step1">
    <xsl:call-template name="replace">
      <xsl:with-param name="before" select="'\'"/>
      <xsl:with-param name="after" select="'\(\backslash\)'"/>
      <xsl:with-param name="string" select="$string"/>
    </xsl:call-template>
  </xsl:variable>
  <!-- Convert "_" -> "\_" -->
  <xsl:variable name="after_step2">
    <xsl:call-template name="replace">
      <xsl:with-param name="before" select="'_'"/>
      <xsl:with-param name="after" select="'\_'"/>
      <xsl:with-param name="string" select="$after_step1"/>
    </xsl:call-template>
  </xsl:variable>
  <!-- many more steps (16) -->
  <xsl:value-of select="$after_step16"/>
</xsl:template>


As you can see, it makes an heavy use of variables, and it may possibly be
related to that.

Can you give me some advice on where it could possibly fail ? So that
i can at least try to debug it ...

Cheers,
-- 
Raphaël Hertzog -+- http://strasbourg.linuxfr.org/~raphael/
Le bouche à oreille du Net : http://www.beetell.com
Naviguez sans se fatiguer à chercher : http://www.deenoo.com
Formation Linux et logiciel libre : http://www.logidee.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]