Re: [xsl] Replacing images with alt tags - PART 2

Subject: Re: [xsl] Replacing images with alt tags - PART 2
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 19 Apr 2002 10:26:50 +0100
Hi Jacob,

> and I also tried:
>
> <xsl:template match='img'>
>         <xsl:choose>
>           <xsl:when test="ancestor::p">
>                 <xsl:value-of select="@alt"/>
>             <xsl:apply-templates/>
>           </xsl:when>
>       <xsl:when test="parent::a">
>                 <xsl:value-of select="@alt"/>
>                 <xsl:apply-templates/>
>           </xsl:when>
>           <xsl:otherwise>
>                 <p>
>                 <xsl:value-of select="@alt"/>
>                 <xsl:apply-templates/>
>                 </p>
>       </xsl:otherwise>
>     </xsl:choose>
>  </xsl:template>
>
> both times I still get nested <p> elements which is invalid wml and
> cannot be viewed by the browser.

>From the snippets that you've shown us and what you've described, this
doesn't seem like the behaviour I'd expect from an XSLT processor. Are
you sure that this is where the nested <p> elements are coming from?
Have you checked that the ancestor <p> elements are in no namespace
rather than the XHTML namespace?

If you post a full example that demonstrates the problem, we'll be
better able to help.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Current Thread