I have a really simple problem that I cannot solve.
I would like to format an xml file using xsl in this simple way.
<A>
<B attribute1="bla1" attribute2="bla2"/>
<C attribute3="bla3" attrribute3="bla4"/>
</A>
and transform it to
<A>
<B
attribute1="bla1"
attribute2="bla2"
/>
<C
attribute3="bla3"
attrribute3="bla4"
/>
</A>
I get something a bit similar using this following code but with problem of indentation
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/开发者_运维知识库Transform" version="1.0">
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates/>
<xsl:for-each select="@*">
<xsl:value-of select="name()"/><xsl:text> = "</xsl:text><xsl:value-of select="."/>"
</xsl:for-each>
</xsl:copy>
</xsl:template>
If some one has an idea how to resolve that it will be great :)
Thanks in advance loic
精彩评论