[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Replacing images with alt tags - PART 2

Subject: Re: Replacing images with alt tags - PART 2
From: "Jacob P. Glenn" <jpglenn2@xxxxxxxxxxx>
Date: Thu, 18 Apr 2002 19:21:37 -0400
glenn jacob
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:

<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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.