HTML in XML

Leigh Dodds ldodds at INGENTA.COM
Thu Dec 20 14:07:29 CET 2001


> <species_comments>The nature of <i>Carcinus maenas</i> is blah blah
> blah.</species_comments>
>
> What I would like to do is have this attribute parsed using XSL and retain
> the formatting over species names. When the text is processed normally the
> HTML tags are dropped.

That's because you're hitting the default template rules, which strips elements
but retains their content.

> If it is kept as CDATA the tags are not dropped but
> also not processed.

If you mean you've got &lt;i>Carcinus maenas&lt;/i> or something similar,
then the XSLT processor won't treat them as tags, but text.

>Any clues how to handle this?

You need a template rule that copies over the contents of this element
into the result tree unchanged.

something like:

<xsl:template match="species_comments">
  <xsl:copy>
     <xsl:copy-of select="@*"/>
     <xsl:apply-templates/>
  </xsl:copy>
</xsl:template>

This should copy the contents unchanged (including attributes) into the
output.

HtH,

Cheers,

L.




More information about the tdwg-content mailing list