Re: fragment transformations

Thomas Comiotto <[email protected]> Wed, 3 Oct 2007 17:20:24 +0200
Newsgroups gmane.comp.mozilla.devel.layout.xslt
Message-ID <[email protected]>
On Oct 3, 2007, at 4:44 PM, Thomas Comiotto wrote:

>>>
>>> 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?
>>
>> Where do you get the range object from? Is that an HTML document  
>> or an
>> XML document?
>
> A local bare bone html document loaded into a collapsed iframe. It's
> for pasting html flavors (into arbitrary xml).
>

Further investigation of the matter lead to the following:

  * Retrieve a html flavor from clipboard: string containing source  
code fixed to be well formed and contains _lower_ case tag names only  
(original source has both upper and lower case tag names)
  * createContextualFragment(str): serializer outputs upper case tag  
names only, attribute names are preserved
  * transformation: lower case element selectors match, upper case  
selectors don't. xsl:copy-of yields to _upper_ case result fragment!!

Strange,
Thomas