[xsl] Fix for correct handling of prefixed attribute names in the XPath Visualizer for Mozilla (Was: Re: pretty-printing XML into HTML)

Subject: [xsl] Fix for correct handling of prefixed attribute names in the XPath Visualizer for Mozilla (Was: Re: pretty-printing XML into HTML)
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Thu, 18 Dec 2003 22:04:59 +0100
Lars,

"Dimitre Novatchev" <dnovatchev@xxxxxxxxx> wrote in message
news:brt26o$qlg$1@xxxxxxxxxxxxxxxx
> Lars,
>
> I wrote:
> > To summarize:
> >
> >   Thank you for finding the bug(s) related to displaying of namespace
> > definitions by the XPV for Mozilla. The fix will be part of the next
> > release.
>
>
> I just checked and it is clear that the handling of namespaces is not a
bug,
> but was really forced by the fact that the XPath engine used by Mozilla
did
> not support the "namespace" axis at all.
>
> As it was impossible to have the nodeset of all namespace nodes belonging
to
> a given element, it was impossible to deal with namespaces as such.
> Therefore, I could only check simple things as if a name had a namespace
> prefix or namespace-uri().

Fortunately, the fix is possible and is just 3 lines:

In mozDss4.xsl

change:
    <xsl:template match="@*">
      <xsl:variable name="belongs"
select="count($selectedNodes|.)-count($selectedNodes)"/>

To:

  <xsl:template match="@*">
    <xsl:variable name="belongs"
select="count($selectedNodes|.)-count($selectedNodes)"/>

    <xsl:if test="contains(name(), ':')">
      <xsl:call-template name="findNamespace"/>
    </xsl:if>


Could you, please,  try to test the mozXPV again?

Even if there will not be a new release soon, people who are interested may
find the fix here and apply it easily.


Thank you once again for pointing out the problem.


Dimitre Novatchev.
FXSL developer

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html







 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread