After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 58791 - xsl:element doesn't create the content
xsl:element doesn't create the content
Status: VERIFIED NOTABUG
Product: libxslt
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
Daniel Veillard
Depends on:
Blocks:
 
 
Reported: 2001-08-09 20:37 UTC by philippe
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description philippe 2001-08-09 20:37:39 UTC
An xsl:element with attributes is not created with the correct values

Example:
<?xml version='1.0' encoding='UTF-8'?>
<form>
    <field name='description'>
        <prompt>Description </prompt>
	<initialvalue>test</initialvalue>
</field>
</form>
 
with the XSL:

<xsl:template match="form">
            <xsl:for-each select="field">
                  <xsl:element name="input">
                        <xsl:attribute name="type">text</xsl:attribute>
                        <xsl:attribute name="name"><xsl:value-of
select="@name" /></xsl:attribute>
                        <xsl:value-of select="initialvalue" />
                    </xsl:element><td><input type="text"
name="description"></td>

            </xsl:for-each>
</xsl:template>

It should give 

<input type="text" name="description">test

but on libxslt 1.0.1 it gives

<input type="text" name="description">

I tested it on Sablotron: correct answer.
Comment 1 Daniel Veillard 2001-08-14 15:00:25 UTC
Well your example is wrong, the opening input tag is not
closed. Normally libxml will not give back a tree for such
and input and hence xsltproc is unlikely to have ever worked
on the example given.

Second once the input is fixed the expected output is
provided:

orchis:~/XSLT/tests/general -> xsltproc bug-57.xsl ../docs/bug-57.xml   
<?xml version="1.0"?>
<input type="text" name="description">test</input><td><input
type="text" name="description"/></td>
orchis:~/XSLT/tests/general -> 

  Sorry, I'm unable to reproduce the bug, it seems the bug was
in your stylesheet in some way.

Daniel
Comment 2 philippe 2001-08-14 19:12:53 UTC
I tried to upload some testcase files, but bugzilla didn want to take
them... So here I will provide the URL's for the stylesheet

http://www.twixel.com/58791/test4.xsl

and the xml file

http://www.twixel.com/58791/test4.xsl

They work OK on Saxon and Sablotron, but not on libxslt. If you remove
the <xsl:output method="html"> tag it works....
Comment 3 Daniel Veillard 2001-08-14 21:04:51 UTC
The bug is on your side I confirm. Saxon and Sablotron are IMHO
broken if they accept this:

orchis:~/tmp -> xsltproc --debug test4.xsl test4.xml
HTML DOCUMENT
standalone=true
  ELEMENT tr
    ELEMENT td
      TEXT
        content=Description 
    ELEMENT td
      ELEMENT input
        ATTRIBUTE type
          TEXT
            content=text
        ATTRIBUTE name
          TEXT
            content=description
        TEXT
          content=test
orchis:~/tmp -> xsltproc test4.xsl test4.xml
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<tr>
<td>Description </td>
<td><input type="text" name="description"></td>
</tr>
orchis:~/tmp -> 

 The XSLT processing generates the "test" text node. It's however
not serialized, the reason is versy simple, the containing
element "input" is empty per the HTML4 DTD

http://www.w3.org/TR/html4/interact/forms.html#edef-INPUT

  Fix your stylesheet,

Daniel