Remove space in between doctype in XML using XSLT -
while transforming xml xml using xslt have included doctype in output xml. line break created in output xml doctype declaration.
xslt:
<xsl:output method="xml" doctype-system="book3.dtd" doctype-public="-//atypon//dtd test//en" version="1.0" encoding="utf-8" indent="no"/>
output xml after using xslt:
<!doctype book public "-//atypon//dtd test//en" "book3.dtd">
space , line break created in between book , public in doctype declaration.
i need doctype declaration in single line.
can me this?
when "need" on 1 line, means must processing resulting xml using parser attaches significance things (like ignorable whitespace) should considered insignficant.
the correct solution problem process xml conformant xml parsers, won't need try , tweak serialized format fit restrictions non-conformant parser imposes.
however, saxon serializer designed customized if have to. call configuration.setserializerfactory()
register subclass of serializerfactory
overrides newxmlemitter()
method create subclass of xmlemitter
, , in subclass of xmlemitter
, override writedoctype()
method format doctype declaration in way want it.
Comments
Post a Comment