spam.spam.spam.s...@free.fr schrieb am 14.02.2012 um 10:59 (+0100): > I write a C program using the libxml2 library.
> I would like to have this output (without editing my XML file) : > "My book "A"" > "My book "B"" > "My book "C"" > > The useless whitespaces are removed from text nodes. > > Is there a function which do this work? Don't know the C API, but in XSLT there's the function normalize-space() and it does just what you want, so you might want to take a look at the source of LibXSLT. Or use XSLT directly. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="text()" priority="2"> <xsl:copy-of select="normalize-space()"/> </xsl:template> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> -- Michael Ludwig _______________________________________________ xml mailing list, project page http://xmlsoft.org/ xml@gnome.org http://mail.gnome.org/mailman/listinfo/xml