Subject: RE: Replacing images with alt tags - PART 2
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Fri, 19 Apr 2002 09:50:36 +0100
|
> Sorry for the confusion. I am new to this stuff and its
> giving me a run
> around. What I am trying to do is convert XHTML pages to WML using a
> stylesheet. The problem I am running into is no matter what
> way I try to
> deal with images I am given invalid WML. In every element I believe I
> apply templates. So within a p element I apply templates. But it
> doesn't seem to discriminate between ancestors. It seems to use just
> the match="img" every time. I tried:
Perhaps there are namespace declarations that you haven't shown us? It's
probably time to post a complete (preferably cut-down) source document and
stylesheet that demonstrate the problem.
Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx
>
> <xsl:template match='img[ancestor::p]'>
> <xsl:value-of select="@alt"/>
> </xsl:template>
>
> <xsl:template match='img[ancestor::a]'>
> <xsl:value-of select="@alt"/>
> </xsl:template>
>
> <xsl:template match='img'>
> <p><xsl:value-of select="@alt"/></p>
> </xsl:template>
>
> 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.
>
> So I don't know if I cleared up the confusion. But I am still having
> this problem so any suggestions would be great.
>
> Jacob
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
Jacob P. Glenn - Thu, 18 Apr 2002 19:16:42 -0400 (EDT)
- Michael Kay - Fri, 19 Apr 2002 04:44:19 -0400 (EDT) <=
- Jeni Tennison - Fri, 19 Apr 2002 05:21:18 -0400 (EDT)
|
|