Re: xsl:comment problem

Jonas Sicking <[email protected]> Thu, 29 Mar 2007 12:16:22 -0700
Newsgroups gmane.comp.mozilla.devel.layout.xslt
Message-ID <[email protected]>
Thomas Comiotto wrote:
> 
> On Mar 9, 2007, at 10:09 AM, Peter Van der Beken wrote:
> 
>> Thomas Comiotto wrote:
>>> <style type="text/css">
>>>   <xsl:comment>
>>>     @import url("<xsl:value-of select="$aVariable"/>/foo/bar.css");
>>>   </xsl:comment>
>>> </style>
>>> does output:
>>>  <style type="text/css">
>>>   <!--
>>>     @import url("/foo/bar.css");
>>>   -->
>>>  </style>
>>
>> Without seeing aVariable it's impossible to know if this is a bug.
>>
>>> <xsl:comment>
>>>   <foo>bar</foo>
>>> </xsl:comment>
>>> <!--
>>> bar
>>> -->
>>
>> http://www.w3.org/TR/xslt#section-Creating-Comments:
>> "It is an error if instantiating the content of xsl:comment creates 
>> nodes other than text nodes. An XSLT processor may signal the error; 
>> if it does not signal the error, it must recover by ignoring the 
>> offending nodes together with their content."
>>
> 
> Ok let's get this one straight; in the above example $aVariable resolves 
> to some #text, so the given example is perfectly compliant with the 
> spec. The xslt processor's not. It does not substitute variables when 
> being descendants of xsl:comment directives, whether those variables 
> reference #text or not.
> 
> 
> I think I'll file a bug.

There might very well be a bug here as I don't fully understand what 
you're doing. I would however recommend that you check what the DOM 
looks like using the DOM Inspector, that might give you some insight 
into what is happening.

Best Regards,
Jonas Sicking