You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by MAHE Vincent FTRD/DIH/REN <v....@rd.francetelecom.com> on 2004/05/25 09:44:00 UTC

RE : How can I remove line feed in my XML output

Thanks to all of you. I've put the following XSL stylesheet in my pipeline in order to remove namespaces (XSP, I18N, ...) and useless line feed and it works fine except that I lose the indentation of the tags.

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" version="1.0" encoding="ISO-8859-1" indent="yes"/>

<xsl:strip-space elements="*"/>

  <xsl:template match="*">
      <!-- remove element prefix (if any) -->
      <xsl:element name="{local-name()}">
        <!-- process attributes -->
        <xsl:for-each select="@*">
          <!-- remove attribute prefix (if any) -->
          <xsl:attribute name="{local-name()}">
            <xsl:value-of select="."/>
          </xsl:attribute>
        </xsl:for-each>
        <xsl:apply-templates/>
      </xsl:element>
  </xsl:template>

</xsl:stylesheet>


Vincent


-----Message d'origine-----
De : news [mailto:news@sea.gmane.org] De la part de Volkm@r
Envoyé : mardi 25 mai 2004 09:25
À : users@cocoon.apache.org
Objet : Re: How can I remove line feed in my XML output


MAHE Vincent FTRD/DIH/REN wrote:
> Hello,
> 
> I have a pipeline which produces XML output with Cocoon.
> I would like to remove useless line feed in the output stream in order 
> to have a beautiful indented XML file. How is it possible ?
> 
> For instance, when I have  this :
> <toto>
> 
> <titi>Hello World</titi>
> </toto>
> 
> I would like to have this as output :
> <toto>
>   <titi>Hello World</titi>
> </toto>

Maybe this will help you ... <http://www.xml.com/pub/a/2001/11/07/whitespace.html>
-- 
Volkmar W. Pogatzki


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: RE : How can I remove line feed in my XML output

Posted by "Volkm@r" <pl...@arcor.de>.
MAHE Vincent FTRD/DIH/REN wrote:
> Thanks to all of you. I've put the following XSL stylesheet in my
> pipeline in order to remove namespaces (XSP, I18N, ...) and useless
> line feed and it works fine except that I lose the indentation of the
> tags.

Your problem isn't very much related to Cocoon. But it is to XSL.
If you like to try something ...
<http://www.azureus.com/xml/art_prettyprinting_xml.htm>

-- 
Volkmar W. Pogatzki


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org