[xml] xsl:value-of on empty tags

Date view Thread view Subject view Author view

From: Robert Klep (robert@ilse.nl)
Date: Tue Mar 06 2001 - 09:04:01 EST


L.S.

I'm having problems (libxml-2.3.3, libxslt-0.4.0) processing empty tags; in
fact, the results seem to be completely wrong.

Take the following XSL sheet:
-snip-
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:template match="foo">
        <FOO>
                <xsl:apply-templates/>
        </FOO>
</xsl:template>

<xsl:template match="bar">
        <BAR>
                <xsl:value-of select="."/>
        </BAR>
</xsl:template>

<xsl:template match="xxx">
        <XXX>
                <xsl:value-of select="."/>
        </XXX>
</xsl:template>

</xsl:stylesheet>
-snip-

and the following XML input:
-snip-
<?xml version="1.0"?>
<foo>
        <bar>This is bar 1</bar>
        <xxx/>
        <bar>This is bar 2</bar>
</foo>
-snip-

The output is:
-snip-
<?xml version="1.0"?>
<FOO>
        <BAR>This is bar 1</BAR>
        <XXX>
        This is bar 2
</XXX>
        <BAR>This is bar 2</BAR>
</FOO>
-snip-

This doesn't seem to be right. If I change the xsl:value-of in the xxx-
template to <xsl:value-of select="text()"/> (or to <xsl:apply-templates/>,
for that matter), the output is more sane.

Am I missing something here?

With kind regards,
Robert

----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Tue Mar 06 2001 - 10:45:45 EST