Re: [xsl] Process XHTML embedded in XML

Subject: Re: [xsl] Process XHTML embedded in XML
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 1 Jun 2001 13:39:57 +0100
This is a VFAQ,

  <xsl:apply-template select="caption" />
  <xsl:template match="caption">

select and match caption in the null namespace, but you want to match
elements in XHTML so

  <xsl:apply-template select="h:caption" />
  <xsl:template match="h:caption">

and stick xmlns:h="";  in your xsl:stylesheet
start tag, so the h prefix is available everywhere in the stylesheet.

You are using value-of on the content of the caption so you lose the
<b> element. If you wanted to keep that you could use copy-of or
apply-templates (with a template for h:b)

Also you've written your template in a very verbose way.

       <xsl:element name="table">
         <xsl:element name="tr">
                <xsl:element name="td"> 
             <xsl:attribute name="align">center</xsl:attribute>
             <xsl:attribute name="width">100</xsl:attribute>
             <xsl:attribute name="height">100</xsl:attribute>
             <xsl:element name="img">
               <xsl:attribute name="src">
                <xsl:value-of select="@filename"/>
               <xsl:attribute name="alt">
                <xsl:value-of select="@filename"/>

is equivalent to

<td align="center" width="100" height="100">
  <img src="{@filename}" alt="{@filename}"/>


This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit or alternatively call
01285 884400.

 XSL-List info and archive:

Current Thread