xsl-list
[Top] [All Lists]

Re: Stripping or converting HTML tags

2004-10-19 08:05:44
Hi Aaron,

Aaron Johnson wrote:

Hello...

I have a html document which is being transformed into XML and then being
re-formatted as XHTML via XSL.

The best route to all that IMHO,  would be some variant of HTMLTidy.

So far I have this, but all it does is make the table disappear completely.

<xsl:template match="xhtml:table | xhtml:TABLE | xhtml:td | xhtml:TD |
xhtml:th | xhtml:TH | xhtml:tr | xhtml:TR">

BTW, elements in uppercase are not valid XHTML.

   <xsl:choose>
   <xsl:when test="*">
          <xsl:value-of select="@p"/>

Here you are testing whether child elements exist and if they do, output the value of the context element's p attribute?

I think you need something like

<><xsl:template match="xhtml:table | xhtml:TABLE | xhtml:td | xhtml:TD |
xhtml:th | xhtml:TH | xhtml:tr | xhtml:TR">
<xsl:apply-templates />
</xsl:template>

This will 'skip' those elements and compared with an identity transform will do what you need.

hth,

Manos