Hi good morning!

I have developed XSLT for transforming xml into xml.

Ex :
input xml

<item>
<name>sample1<name>
<desc></desc>
</item>

output xml

<item>
<name>sample1<name>
<desc/>
</item>

In the transformed xml file I am getting self closing tag for the empty data element.

But for us our parser does not support self closing tag. I want the trans formed file
output with out self closing tag.

Thats a severe problem with the parser, so ideally, fix the parser. Is it an inhouse solution? If so, use a base framework like SAX2/DOM rather than manually writing the parser component. Will save on alot of potential headaches.

If you absolutely must use this parser without fixing it, do the following in elements that may be empty:

<desc>
<xs:comment>parser bug fix</xs:comment>
... other potential content...
</desc>

which will expand to the following on the occasion that desc is otherwise empty.

<desc>
<!--parser bux fix-->
</desc>

Your substandard parser does support comments, right?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.