Subject: [xsl] 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) |
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="', 	 '"/> </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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] outputting multiple docum, Joerg Heinicke | Thread | RE: [xsl] Bug in treating an RTF by, Stuart Celarier |
Re: [xsl] how to apply sum to a com, Mike Brown | Date | Re: [xsl] how to apply sum to a com, Mike Brown |
Month |