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

Here should go questions about transforming XML with XSLT and FOP.
Jeremy
Posts: 1
Joined: Tue Mar 17, 2009 5:27 pm

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

Post 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
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

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

Post 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
Post Reply