xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Dupras <bri...@centera.com>
Subject XHTML with Namespaces -> HTML 4.0 Loose
Date Fri, 17 Mar 2000 00:04:52 GMT
I have an interesting dilema - I need to convert a bunch of Data, Text, and
XHTML (with namespaces) into HTML4.  The spin is that the Data may contain
user-input html elements that my system treats as opaque.  For instance, I
give the user a form to enter text.  

If they type in "This is a sample.", then I generate  <html:p>This is a
sample.</html:p>  by using DOM and addTextNode().

If they type in "This is an <b>HTML</b> sample.", then I generate
<html:p>This is an &lt;b>HTML&lt;b> sample.</html:p> by using the
same DOM

What I need to do is pull that same XML out of storage and spit out to the
browser, "<p>This is an <b>HTML</b> sample.</p>" using XSLT if I can.

There are two things here.  First, I need to be sure that my own <html:*>
elements get translated to valid HTML 4 (singular <br> tags from <html:br/>,
for example).  Also, I need to pass through the user's input text, including
and valid or broken HTML tags that they typed in.

The XSLT doc I wrote to do that is presently not working properly.  It is
included below.  I'm sure this is just a matter of getting the
output-method, output escaping, text formatting, etc all set up properly.  I
could use some pointers here, though.

By specifying that the output-method is "html", I should get some singular
tags like <br>.  But, in my output from below, I'm still getting <br/>.  I
think this might have to do with creating the elements from scratch useing

If I pass in the above html example, the xslt below spits out "This is an
&lt;b>HTML&lt;b> example.", which obviously causes the <b> tag to render
the page instead of bolding the text.

Thanks for any advice.

Brian Dupras
Centera Information Systems, Inc.
phone 303.381.4420 (direct)
phone 303.939.0200 (operator)
fax	303.939.0111
web	http://www.centera.com
email	briand@centera.com

My broken XHTML -> HTML xslt:

<?xml version="1.0"?>

<xsl:template match="/">

<xsl:template match="html:*">
	<xsl:element name="{substring-after(name(.),':')}">
		<xsl:for-each select="@*">
			<xsl:attribute name="{name(.)}"><xsl:value-of


View raw message