Hi,
I'm creating a system where my XML includes HTML tags (<h1></h1>) in addition to other XML elements (<book></book>).
I would like to render the HTML tags back to HTML using XSL. Considering I want to replace all headings, I could do for each heading level (i.e. repeat the following code for h2, h3, h4, h5, etc.):
<xsl:template match="h1">
<h1><xsl:apply-templates/></h1>
</xsl:template>
or I can just write once:
<xsl:template match="*[starts-with(local-name(), 'h')]">
<xsl:copy><xsl:apply-templates/></xsl:copy>
</xsl:template>
The problem is that with xsl:copy, I'm loosing the 'native' HTML appearance of the tags. For example, the headings will be displayed inline rather than block. To solve this I can just edit the stylesheet and add display:block to all headings - meaning I'm doing extra job anyway, but I was wondering if there is any smart way of doing this.
Ideally, I would like to do something like this:
<xsl:template match="p|ul|li|dl|dt|dd|i|em|strong|b">
<xsl:copy><xsl:apply-templates/></xsl:copy>
</xsl:template>
rather than writing each separately.
Thanks in advance,
Izhaki