Re: [xslt] xsltproc: no output for copy-of text nodes



Daniel Veillard <veillard@redhat.com>:
>On Wed, Jan 02, 2002 at 09:29:35AM -0800, Steven E Lumos wrote:
>> 
>> Given the XML:
>> 
>>    <a>                      
>>      <b>Want this</b>       
>>      <c>Don't want this</c> 
>>    </a>
>> 
>> I get no output from xsltproc with the following stylesheet:
>> 
>>    <?xml version="1.0" encoding="utf-8"?>                              
>>    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";    
>>                    version="1.0">                                      
>>                                                                        
>>      <xsl:output method="text"/>                                       
>>                                                                        
>>      <xsl:template match="//b/text()">                                 
>>        <xsl:copy-of select="."/>                                       
>>      </xsl:template>                                                   
>>                                                                        
>>      <xsl:template match="text()|@*"/>                                 
>>                                                                        
>>    </xsl:stylesheet>                                                   
>> 
>>    $ xsltproc --debug xsltproc-bug.xsl xsltproc-bug.xml   
>>    DOCUMENT                                               
>>    version=1.0                                            
>>    standalone=true                                        
>> 
>> Saxon and Xerces both output "Want this".  I get what I expect from
>> xsltproc if I use "//b//text()" instead. 
>
>  Strange. I have seen your bug report but didn't had time yet to look at it.
>
>> I also get what I expect
>> with the original XPath using xmllint:
>> 
>>    / > ls //b/text()
>>    t--        9 Want this
>
>  Yes but the template matching code is not the XPath selection code,
>this may be a bug in the former.
>
>Daniel

That's a good clue.  If I change the template to:

  <xsl:template match="/">
    <xsl:copy-of select="//b/text()"/>
  </xsl:template>

it works.

Steve



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