[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Bug in treating an RTF by Saxon 6.5 and MSXML4

Subject: Bug in treating an RTF by Saxon 6.5 and MSXML4
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Wed, 15 May 2002 11:06:42 -0700 (PDT)
bug saxon xsl variable
When given the following xml source:

sumCSV.xml:
----------
<csv>1, 2, 3,4,5   
6,
7,8     , 9
,10
</csv>

and the following stylesheets:

testBug.xsl:
-----------
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:vendor="http://icl.com/saxon"
>

   <xsl:import href="buggy.xsl"/>

   <xsl:output indent="yes" omit-xml-declaration="yes"/>
   
    <xsl:template match="/">
        <xsl:call-template name="str-split-to-words">
          <xsl:with-param name="pStr" select="/"/>
          <xsl:with-param name="pDelimiters" 
                          select="', &#9;&#10;&#13;'"/>
        </xsl:call-template>
    </xsl:template>
</xsl:stylesheet>


and the imported buggy.xsl:

buggy.xsl:
---------
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:vendor="http://icl.com/saxon"
xmlns:str-split2words-func="f:str-split2words-func"
exclude-result-prefixes="xsl vendor str-split2words-func"
>

   <xsl:import href="str-foldl.xsl"/>

   <str-split2words-func:str-split2words-func/>

    <xsl:template name="str-split-to-words">
      <xsl:param name="pStr"/>
      <xsl:param name="pDelimiters"/>
      
      <xsl:variable name="vsplit2wordsFun"
                    select="document('')/*/str-split2words-func:*[1]"/>
                    
      <xsl:variable name="vrtfParams">
       <delimiters><xsl:value-of select="$pDelimiters"/></delimiters>
      </xsl:variable>

      <xsl:variable name="vResult">
	 <xsl:call-template name="str-foldl">
	   <xsl:with-param name="pFunc" select="$vsplit2wordsFun"/>
	   <xsl:with-param name="pStr" select="$pStr"/>
	   <xsl:with-param name="pA0" 
                           select="vendor:node-set($vrtfParams)"/>
	      </xsl:call-template>
      </xsl:variable>
      
      <xsl:copy-of select="vendor:node-set($vResult)/word"/>

    </xsl:template>

    <xsl:template match="str-split2words-func:*">
      <xsl:param name="arg1" select="/.."/>
      <xsl:param name="arg2"/>
         
      <xsl:copy-of select="vendor:node-set($arg1)/*[1]"/>
<!--Err--> <xsl:copy-of select="$arg1/word[position() != last()]"/>
      
      <xsl:choose>
<!--Err--> <xsl:when test="contains($arg1/*[1], $arg2)">
<!--Err-->  <xsl:if test="string($arg1/word[last()])">
<!--Err-->   <xsl:copy-of select="$arg1/word[last()]"/>
           </xsl:if>
          <word/>
        </xsl:when>
        <xsl:otherwise>
<!--Err-->   <word><xsl:value-of 
                select="concat($arg1/word[last()], $arg2)"/></word>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:template>

</xsl:stylesheet>


SAXON 6.5 and MSXML4 *do not* issue any error messages. In fact, all
lines starting with <!--Err--> are illegal treatment of an RTF as a
node-set and the XSLT processor must issue an error message (on any of
them) and stop processing.

XALAN-J-2.3 is correct and issues an error message.

The only other stylesheet, necessary to reproduce this behavior is
given bellow:

str-foldl.xsl:
-------------
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template name="str-foldl">
      <xsl:param name="pFunc" select="/.."/>
      <xsl:param name="pA0"/>
      <xsl:param name="pStr"/>

      <xsl:choose>
         <xsl:when test="not(string($pStr))">
            <xsl:copy-of select="$pA0"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:variable name="vFunResult">
              <xsl:apply-templates select="$pFunc[1]">
                <xsl:with-param name="arg0" 
                                select="$pFunc[position() > 1]"/>
                <xsl:with-param name="arg1" select="$pA0"/>
                <xsl:with-param name="arg2" 
                                select="substring($pStr,1,1)"/>
              </xsl:apply-templates>
            </xsl:variable>

            <xsl:call-template name="str-foldl">
		<xsl:with-param name="pFunc" select="$pFunc"/>
		<xsl:with-param name="pStr" 
                                select="substring($pStr,2)"/>
		<xsl:with-param name="pA0" select="$vFunResult"/>
            </xsl:call-template>
         </xsl:otherwise>
      </xsl:choose>

    </xsl:template>
</xsl:stylesheet>


I hope that this bug will be fixed in the next version of SAXON and
MSXML.

Cheers,
Dimitre Novatchev.


__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.