This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Process XHTML embedded in XML



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="http://www.w3.org/1999/xhtml";  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>
               <xsl:attribute name="alt">
                <xsl:value-of select="@filename"/>
            </xsl:attribute>
             </xsl:element>
                </xsl:element>
         </xsl:element>


is equivalent to

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



David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
01285 884400.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]