[xsl] Re: Re: Re: Re: Converting specific child elements into att riutes of parent

Subject: [xsl] Re: Re: Re: Re: Converting specific child elements into att riutes of parent
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Mon, 3 Nov 2003 21:08:53 +0100
> This did not give the error and resulted in expected results.  I could get
> the result with JRE itself i.e., without having to specify
> the -Xbootclasspath/p flag.  Does that mean XalanJ 2.4.1, Saxon 6.5.3,
> MSXML3, etc are suppressing this error? Whether the processors which issue
> this error are XSLT compliant or is it the otherway?
>
> Thanks to all for spending your time on this and helping to resolve this.

There *was* an error in my solution.

This:

      <xsl:when test="not(name() = $elNames)">
        <xsl:copy>
          <xsl:copy-of select="@*"/>
          <xsl:apply-templates select="*[name() = $elNames]"/>
          <xsl:apply-templates/>
        </xsl:copy>
      </xsl:when>

is applying templates first to all elements, whose name is one of the names
listed in $elNames. Then it is applying templates to all children of the
current node (in document order). So templates are applied for a second time
to the children of the current node, whose name is listed in $elNames. If
there are other children before these in document order, applying templates
to them will "close the element" and then when a child element with a name
listed in $elNames is processed, this will attempt to create an attribute
when no element node is "in the process of creation"

This explains the error messages, which are correct.

The above snippet must be replaced by:

      <xsl:when test="not(name() = $elNames)">
        <xsl:copy>
          <xsl:copy-of select="@*"/>
          <xsl:apply-templates select="*[name() = $elNames]"/>
          <xsl:apply-templates
               select="node()[not(name() = $elNames)]"/>
        </xsl:copy>
      </xsl:when>

Now all XSLT processors I have installed with the exception of one perform
the transformation without any error messages -- Saxon 6.5.3, Saxon 7, Xalan
C 1.5, .Net xslTransform, MSXML3/4, JD, 4xslt, xsltProc

The only xslt processor, which simply crashes is XalanJ 2.4.1. I get the
following message:

">>>>>>> Xalan Version Xalan Java 2.4.1, <<<<<<<

(Location of error unknown)XSLT Error
(javax.xml.transform.TransformerConfigurationException):
javax.xml.transform.TransformerException: java.net.MalformedURLException:
unknown protocol: e"



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL







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


Current Thread