xsl-list
[Top] [All Lists]

Re: [xsl] <param> tag in input document breaks <xsl:copy-of select="." />

2013-07-03 04:10:27

How are you viewing the output?

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.

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(_at_)lists(_dot_)ubuntu(_dot_)com>
Original-Maintainer: Debian XML/SGML Group
<debian-xml-sgml-pkgs(_at_)lists(_dot_)alioth(_dot_)debian(_dot_)org>
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(_at_)lists(_dot_)ubuntu(_dot_)com>
Original-Maintainer: Debian XML/SGML Group
<debian-xml-sgml-pkgs(_at_)lists(_dot_)alioth(_dot_)debian(_dot_)org>
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?

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--