XML/XSL transformation question.
-
Howdy' I'm generating some XML files with MSXML; The text is all put on one single line; so I'm trying to transform the document with some XSL "black" magic. The stylesheet (taken from some google-search):
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:template match="*">
xsl:copy
<xsl:copy-of select="@*" />
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>This works well, except for one minor thing. For empty "tags", the transformation transform :
<MyTag attribute="value"/>
to
<MyTag attribute="value"></MyTag >
I'm not quite familiar with XSL, and was wondering if there's a way to not create the empty closing tags ? I hope it makes sens. Thanks. Max.
This signature was proudly tested on animals.
-
Howdy' I'm generating some XML files with MSXML; The text is all put on one single line; so I'm trying to transform the document with some XSL "black" magic. The stylesheet (taken from some google-search):
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:template match="*">
xsl:copy
<xsl:copy-of select="@*" />
<xsl:apply-templates />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>This works well, except for one minor thing. For empty "tags", the transformation transform :
<MyTag attribute="value"/>
to
<MyTag attribute="value"></MyTag >
I'm not quite familiar with XSL, and was wondering if there's a way to not create the empty closing tags ? I hope it makes sens. Thanks. Max.
This signature was proudly tested on animals.
Is there a reason why you don't want the closing tag? Both of the nodes, the one with the
/>
and the one with the></MyTag>
have the same meaning in XML and should parse the same way...."we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty
-
Is there a reason why you don't want the closing tag? Both of the nodes, the one with the
/>
and the one with the></MyTag>
have the same meaning in XML and should parse the same way...."we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty
For no other reason than "aestheticism"
This signature was proudly tested on animals.
-
For no other reason than "aestheticism"
This signature was proudly tested on animals.
Yeah, I like it that way, too. No, if you're using MSXML, there's no way to force it to output
/>
. It's hard-coded to do that, as far as I know, having used it for quite a long time."we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty