convert xhtml back to html
Tim Arnold
tim.arnold at sas.com
Fri Apr 25 13:29:54 EDT 2008
"bryan rasmussen" <rasmussen.bryan at gmail.com> wrote in message
news:mailman.138.1209061180.12834.python-list at python.org...
> I'll second the recommendation to use xsl-t, set the output to html.
>
>
> The code for an XSL-T to do it would be basically:
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
> <xsl:output method="html" />
> <xsl:template match="/"><xsl:copy-of select="/"/></xsl:template>
> </xsl:stylesheet>
>
> you would probably want to do other stuff than just copy it out but
> that's another case.
>
> Also, from my recollection the solution in CHM to make XHTML br
> elements behave correctly was <br /> as opposed to <br/>, at any rate
> I've done projects generating CHM and my output markup was well formed
> XML at all occasions.
>
> Cheers,
> Bryan Rasmussen
Thanks Bryan, Walter, John, Marc, and Stefan. I finally went with the xslt
transform which works very well and is simple. regexps would work, but they
just scare me somehow. Brian, my tags were formatted as <br /> but the help
compiler would issue warnings on each one resulting in log files with
thousands of warnings. It did finish the compile though, but it made
understanding the logs too painful.
Stefan, I *really* look forward to being able to use lxml when I move to RH
linux next month. I've been using hp10.20 and never could get the requisite
libraries to compile. Once I make that move, maybe I won't have as many
markup related questions here!
thanks again to all for the great suggestions.
--Tim Arnold
More information about the Python-list
mailing list