UltraNurd
UltraNurd

Reputation: 1334

Combine lxml XSLT pretty_print with strip-space

I'm cleaning up some gross XML, and so I've had pretty_print = True set in the call to etree.tostring() on my lxml output of the XSL transform. However, that left me with a few junk whitespace nodes from the original input, so I added

<xsl:strip-space elements="*"/>

...but that completely collapses all whitespace, ignoring pretty print. Is there an easy way to make strip-space just apply to the input, and still get lxml to apply pretty print?

Upvotes: 0

Views: 836

Answers (1)

hcayless
hcayless

Reputation: 1046

Do it in two steps? First strip the spaces, then pretty-print?

Just a thought.

Upvotes: 1

Related Questions