Re: [xml] Why does XML::LibXSLT (= the Perl 5 / CPAN wrappers for libxslt) Fails a Basic Test on some BSD and other systems?



On Feb 17, 2014, at 09:11 , Shlomi Fish <shlomif shlomifish org> wrote:

OK, but I don't understand whether I have done something wrong in my XSLT
stylesheet or alternatively whether it is a bug or an impedance-mismatch
between libxml2 and libxslt. I'll try running the offending code in Perl with
the latest git versions of libxml2 and libxslt, but I'd like to be sure. One of
my problems is that I didn't quite understand the technical details and
explanation that were discussed here (as I read the Zvon XSLT tutorial in the
past, but have not read a more comprehensive book or a SPEC, and furthermore,
have forgotten a lot of details).

Can you enlighten me, please?

It’s a problem with you stylesheet. XSLT like this is wrong:

    <elem xml:space=“preserve">
        <xsl:attribute name=“attr”>value</xsl:attribute>
    </elem>

The problem is that there is a text node containing whitespace before the xsl:attribute. Text nodes and 
element nodes are not allowed before xsl:attribute. Normally, these whitespace nodes will be stripped. But 
since there’s a parent element with xml:space=“preserve”, the whitespace will be kept in this case. I just 
checked with Saxon and it also reports an error.

Nick



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]