[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] tag in input document breaks


Subject: Re: [xsl] <param> tag in input document breaks <xsl:copy-of select="." />
From: Evgeny Turnaev <turnaev.e@xxxxxxxxx>
Date: Wed, 3 Jul 2013 15:20:55 +0400

Michael, sorry for cross posting, but i got response in grome.org mail list.
"""
<param> is an empty element in HTML 4.0, so the HTML output method
removes its contents.
"""
issue is closed.
Michael, thanks for reply!

2013/7/3 Evgeny Turnaev <turnaev.e@xxxxxxxxx>:
> 2013/7/3 Michael Kay <mike@xxxxxxxxxxxx>:
>>
>> How are you viewing the output?
>
> In console. libxslt_tutorial.c outputs to stdout. I am also getting
> same with xsltproc cmd util.
>
>>
>> If this is the serialized output of the XSLT processor, then it's wrong and
clearly a bug in the XSLT processor. On the other hand, if it is the result of
loading the (invalid) HTML into a browser and then viewing the resulting DOM,
then it might well be legitimate - browsers do strange things with invalid
HTML.
>>
>> Either way, one has to ask why you are using the HTML output method when
your stylesheet result is not HTML.
>
> That is definitely a good question. Originally issue was found by my
> colleague (xslt programmer while i am a python programmer).
> Our output is mostly html so to prevent xslt engine from closing empty
> tags (<span></span> -> <span/>) we use output method html in our
> templates. And so my colleague stumbled the issue while trying to
> debug input tree using this construction:
> <xsl:template match="/">
>    <textarea><xsl:copy-of select="."></textarea>
> </xsl:template>
> So this issue looks like a minor for us, because this is not our
> primary usage. It is seems we still can traverse the tree.
> the only thing that is not working <xsl:copy-of select="param">.
> But still it looks like a bug.
>
>>
>> Michael Kay
>> Saxonica
>>
>>
>> On 3 Jul 2013, at 09:44, Evgeny Turnaev wrote:
>>
>>> Hello.
>>>  Dear All, i have searched the web and this mail list and found
>>> nothing related to my question.
>>>  Sorry if this is something obvious and mentioned in xml standard but
>>> this really looks strange to me.
>>>
>>> The Question:
>>>
>>> Given this input document:
>>> <?xml version="1.0" encoding="UTF-8" ?>
>>> <param>
>>> <sometag>Hello world</sometag>
>>> </param>
>>>
>>> And this simple stylesheet:
>>> <?xml version="1.0" encoding="utf-8"?>
>>> <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
>>> <xsl:output method="html"/>
>>>
>>> <xsl:template match="/">
>>>    <xsl:copy-of select="." />
>>> </xsl:template>
>>>
>>> </xsl:stylesheet>
>>>
>>> The output is:
>>> <param>
>>>
>>> While i expect output:
>>> <param>
>>> <sometag>Hello world</sometag>
>>> </param>
>>>
>>> However changing <param> tag in input document to some other tag fixes
>>> problem and output match expectations.
>>> Also changing <xsl:output method="html"/> to <xsl:output
>>> method="xml"/> fixes problem, but i really want to keep <xsl:output
>>> method="html"/>.
>>> I have stumbled this while making transform on xml-rpc output: it
>>> starts with <methodResponse><params><param> and all the contents of
>>> <param> tag is missing in output.
>>> Is there something special about <param> tag in input document? I
>>> suppose input document tags should not anyhow change result of
>>> <xsl:copy-of select="." />, is'nt it?
>>>
>>> Some technical info:
>>> Transformation code was taken literally as copy of example from page:
>>> http://xmlsoft.org/XSLT/tutorial/libxslttutorial.html
>>> (
>>> and then
>>> gcc ./libxslt_tutorial.c -o ./test_xslt -I/usr/include/libxml2 -lxml2
-lxslt
>>> ./test_xslt output.xsl xml_rpc.xml
>>> )
>>> System: ubuntu 12.04
>>> Linux mtnp 3.2.0-36-generic #57-Ubuntu SMP Tue Jan 8 21:44:52 UTC 2013
>>> x86_64 x86_64 x86_64 GNU/Linux
>>>
>>> libxml & libxslt installed via apt-get
>>> Package: libxml2
>>> Priority: standard
>>> Section: libs
>>> Installed-Size: 1745
>>> Maintainer: Ubuntu Developers <ubuntu-devel-discuss@xxxxxxxxxxxxxxxx>
>>> Original-Maintainer: Debian XML/SGML Group
>>> <debian-xml-sgml-pkgs@xxxxxxxxxxxxxxxxxxxxxxx>
>>> Architecture: amd64
>>> Version: 2.7.8.dfsg-5.1ubuntu4
>>> Depends: libc6 (>= 2.15), zlib1g (>= 1:1.2.3.3.dfsg)
>>>
>>>
>>> Package: libxslt1.1
>>> Priority: optional
>>> Section: libs
>>> Installed-Size: 468
>>> Maintainer: Ubuntu Developers <ubuntu-devel-discuss@xxxxxxxxxxxxxxxx>
>>> Original-Maintainer: Debian XML/SGML Group
>>> <debian-xml-sgml-pkgs@xxxxxxxxxxxxxxxxxxxxxxx>
>>> Architecture: amd64
>>> Source: libxslt
>>> Version: 1.1.26-8ubuntu1
>>> Depends: libc6 (>= 2.4), libgcrypt11 (>= 1.4.5), libxml2 (>= 2.7.4)
>>>
>>>
>>> Any thoughts or suggestions?


Current Thread
Keywords