Re: fragment transformations
Jonas Sicking <[email protected]> Wed, 03 Oct 2007 13:55:04 -0700
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Message-ID | <[email protected]> |
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. / Jonas