Re: How to stream HTML tags included in XML using XSL

Subject: Re: How to stream HTML tags included in XML using XSL
From: Toivo Lainevool <tlainevool@xxxxxxxxx>
Date: Tue, 25 Apr 2000 09:40:18 -0700 (PDT)
--- Marcel Ruff <ruff@xxxxxxxxxxxxx> wrote:
> we have a XML document and want to add some formatting elements,
> like <bold> or better <b> which should show up in the generated HTML
> file.
> 
> How can we tell the XSL engine to stream such tags
> into the destination HTML file.

One way is to put the html tags in a separate namespace like this:

<doc xmlns="Whatever namespace is default"
     xmlns:html="xmlns:html="http://www.w3.org/TR/REC-html40/loose.dtd"";>
  <aTag>
    <html:p>
      A paragraph of text...
    </html:p>
  </aTag>
</doc>

and then use a template to pass through all of the html prefixed tags without
the prefix:

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:html="http://www.w3.org/TR/REC-html40/loose.dtd";
                exclude-result-prefixes="html">

... other templates ...

<xsl:template match="html:*">
    <xsl:element name="{local-name(.)}"><xsl:apply-templates/> 
	</xsl:element>
</xsl:template>

</xsl:stylesheet>

That should do the trick.

Toivo Lainevool

__________________________________________________
Do You Yahoo!?
Send online invitations with Yahoo! Invites.
http://invites.yahoo.com


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread