Re: fragment transformations

Thomas Comiotto <[email protected]> Thu, 4 Oct 2007 07:59:37 +0200
Newsgroups gmane.comp.mozilla.devel.layout.xslt
Message-ID <[email protected]>
Hi Jonas

On Oct 3, 2007, at 10:55 PM, Jonas Sicking wrote:

> Thomas Comiotto wrote:
>> Hi all,
>>
>>
>> I have mozilla transforming a fragment obtained by
>> range.createContextualFragment() to some target format. It all works
>> very nice. Great! But only when I use lower case tag names in my xslt
>> selectors. I'm happy with that it works but wonder why..
>>
>> Given a html tag soup that after being parsed serializes to a
>> well-formed something in null namespace with all upper case html  
>> tags:
>> why does the xslt transformer match lower case tag equivalents only?
>>
>> 1. var str = "<p>a paragraph<p>next paragraph"
>> 2. var fg = range.createContextualFragment(str)
>> 3. serializeToString(fg) -> <P>a paragraph</P><P></P>
>> 4. xsl:template match="P" -> no match, xsl:template match="p" ->  
>> match
>>
>> Is this stuff documented somewhere? Or may I simply miss the point?
>
> Transforming HTML using XSLT is something that isn't really supported.
> It does mostly work, though as you notice you have to use lowercase
> names in patterns and expressions. The reason you have to use lower  
> case
> is basically a bug due to internal implementation details.
>
> Ideally patterns and expressions should be case insensitive when  
> used in
> XSLT when transforming HTML nodes.
>
> Feel free to file a bug on this, but in the mean time i'd recommend
> simply using lower case as a workaround.
>


Thanks for the clarification! Wouldn't it make sense to add a  
corresponding note to
http://developer.mozilla.org/en/docs/XSL_Transformations_in_Mozilla_FAQ
or possibly
http://developer-cluster.mozilla.org/en/docs/ 
Using_the_Mozilla_JavaScript_interface_to_XSL_Transformations


Thanks,
Thomas