[xml] xsl:strip-space bug

Date view Thread view Subject view Author view

From: Robert (robert@00008.org)
Date: Mon Mar 05 2001 - 03:35:32 EST


L.S.

It seems <xsl:strip-space> doesn't work the way it should (using
libxslt-0.4.0 and libxml2-2.3.3), or I'm just not understanding it.

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

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

<xsl:template match="bar">
  <BAR INDEX="{position()}">
    <xsl:value-of select="."/>
  </BAR>
</xsl:template>

</xsl:stylesheet>
-snip-

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

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

Now, I expected the INDEX values to be 1, 2, 3, respectively. When I
replace '*' with 'foo' in <xsl:strip-space>, it indeed shows 1, 2, 3.

Either I'm missing something, or libxslt is :)

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 : Mon Mar 05 2001 - 06:44:18 EST