xsl-list
[Top] [All Lists]

Re: bug in LibXSLT???

2003-03-07 02:00:35

--- S Woodside <sbwoodside(_at_)yahoo(_dot_)com> wrote:
On Thursday, March 6, 2003, at 04:09  AM, Daniel Veillard wrote:

  Well can you provide a concise example ?

OK, I reduced the input and code down a lot. It still displays the 
potential bug. If I'm screwing something up, I'd love to know what.

I managed to simplify your example a little bit more and now we have
another, probably related problem.

This is the source xml document:


<grammar>   
  <start>     
    <element name="a">       
      <optional>         
        <element name="b">           
          <optional>             
            <element name="c">               
              <optional>                 
                <attribute name="d">                   
                </attribute>               
              </optional>             
            </element>           
          </optional>         
        </element>       
      </optional>     
    </element>   
  </start>
</grammar>


This transformation:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
version="1.0" >   
  <xsl:output omit-xml-declaration="yes"/>   
  <xsl:template match="attribute">     
      <path>         
        <xsl:call-template name="RNGPathToSelf"/>       
      </path>       
      <xsl:apply-templates/>     
  </xsl:template>   
  <xsl:template name="RNGPathToSelf">
    <xsl:variable name="vAncestors"
select="ancestor-or-self::*/@name"/>
    <xsl:for-each select="$vAncestors">       
      <xsl:text>/</xsl:text>       
      <xsl:value-of select="."/>     
    </xsl:for-each>   
  </xsl:template>
</xsl:stylesheet>

when applied on the above source xml document produces this result
(surrounding whitespace skipped to conserve space):

<path>/d/c/b/a</path>

As we see, the following code

    <xsl:for-each select="$vAncestors">       
      <xsl:text>/</xsl:text>       
    <xsl:value-of select="."/>     

does not output in document order the values of the nodes contained in
the nodeset.


All other XSLT processors I've tried produce the result as per spec:

<path>/a/b/c/d</path>




=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

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



<Prev in Thread] Current Thread [Next in Thread>