[xslt] output-method='text' -- strange behavior



Hi!
LibXSLT is a great thing, it has great perfomance and very cool
possibility to cache parsed stylesheets, XMLs etc. But it has very
strange behavior when output method is text.

Simple testcase:
XML:
-------------------------------------
<?xml version="1.0"?>
<message>
<error type="interaction">
<parameter type="incorrect_value">url</parameter>
<parameter type="incorrect_value">folder</parameter>
</error>
</message>
------------------------------------- 
XSL:
-------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method='text' encoding="iso-8859-1"/>
<xsl:template match="message">
 <xsl:apply-templates/>
</xsl:template>

<xsl:template match="error">
 <xsl:choose>
  <xsl:when test="@type='interaction'">
    <font color="#ff0000" size="+1">This values are missed or incorrect:
    <xsl:for-each select="parameter">
     <xsl:call-template name="incorrect_value"/>
    </xsl:for-each>.
    </font>
  </xsl:when>
 </xsl:choose>
</xsl:template>

<xsl:template name="incorrect_value">
 <xsl:choose>
  <xsl:when test=".='url'">address</xsl:when>
  <xsl:when test=".='name'">name</xsl:when>
  <xsl:when test=".='folder'">folder</xsl:when>
  <xsl:when test=".='period'">period</xsl:when>
 </xsl:choose>
 <xsl:if test="not(position()=last())">, </xsl:if>
</xsl:template>

<xsl:template match="parameter"></xsl:template>

</xsl:stylesheet>

-------------------------------------

When output method is html all is ok.
Output:
----------------------------
<font color="#ff0000" size="+1">This values are missed or incorrect:
    address, folder.
    </font>
----------------------------

When output method is text nothing outputed :-(
For this XML/XSL output method is not very importent, but we have many 
big stylesheets, which needs output-method='text'.

I using libxslt 0.7.0, libxml 2.2.9 on RedHat Linux 6.2. 

Any comments?

With best regards,
Anton

-- 
mailto:boyarsh mail ru
mailto:boyarsh ru echo fr






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