[Mono-list] Mono not using self closing tags.

MarxWright michael.e.harrison at hotmail.com
Mon Mar 9 08:38:55 UTC 2015

I'm trying to remove the closing tag from my transformed document but it only
creates a newline and full closing tags: 

<item Data="XXX" Data1="123.24" Num="3">

As I have a lot of data I would prefer: <item Data="XXX" Data1="123.24"
Num="3" />

I cannot seem to find the solution anywhere. To annoy me more it works as
desired on Windows but not when running on Wheezy using mono which
makes me think perhaps a Mono component is causing my trouble. 

Has anyone got any ideas? 

This is the code I use: 

    XmlWriterSettings xmlSettings = new XmlWriterSettings(); 
    xmlSettings.Indent = true; 
    xmlSettings.NewLineChars = "\n"; 
    xmlSettings.OmitXmlDeclaration = true; 

    XmlReader reader = XmlReader.Create(new StringReader(xml)); 

    using (XmlWriter writer = XmlWriter.Create(outputStream, xmlSettings)) 
         m_SoapXSLT.Transform(reader, writer); 

    string outStr = outputStream.ToString(); 

Here is a sample from my XSL document: 

<?xml version="1.0" encoding="UTF-8" ?> 

<xsl:stylesheet version="3.0" 
exclude-result-prefixes="xs xdt err fn">

<xsl:output method="xml" indent="yes"  omit-xml-declaration="yes"/>

<xsl:if test="self::node()[@type='46']">
    <xsl:element name="elementName">
        <xsl:attribute name="NumItems">
            <xsl:for-each select="self::node()/items/item">
                <xsl:element name="item">
                    <xsl:attribute name="Data">
                        <xsl:value-of select="@data1"/>
                    <xsl:attribute name="Data1">
                        <xsl:value-of select="@data2"/>
                    <xsl:attribute name="Num">
                        <xsl:value-of select="position()"/>

Regards, Mike! 

View this message in context: http://mono.1490590.n4.nabble.com/Mono-not-using-self-closing-tags-tp4665600.html
Sent from the Mono - General mailing list archive at Nabble.com.

More information about the Mono-list mailing list