Page 1 of 1

How to stop <mytag></mytag> being transformed to <mytag/>

Posted: Tue Mar 17, 2009 6:08 pm
by Jeremy
I need to preserve empty tag pairs from my source XML document as pairs when running a transform on it to generate a modified XML file and not convert them to the single tag form. (I know it shouldn't matter, but the consuming application insists on the full pair.)

Ticking "Preserve text as is" and/or "Expand empty element" does not stop Saxon "tidying up" my XML..

Anyone know how to make this work? Thanks

Re: How to stop <mytag></mytag> being transformed to <mytag/>

Posted: Wed Mar 18, 2009 11:10 am
by sorin_ristache
Hello,

You can force empty tag pairs in a Saxon transformation with xsl:output/@method="html" in an XSLT 1.0 stylesheet or with xsl:output/@method="xhtml" in an XSLT 2.0 stylesheet.


Regards,
Sorin