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]

xsl:when and xsl:choose


OK,

Accoding to my documentation, something like this should work (unless of
course I am misinterpreting the documentation, which is highly likely.
(Introduction to XML)

<xsl:template match="/">
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="ELEMENT">

<xsl:choose>
   <xsl:when match="[@initcost='0']">
	<img src="c:\windows\desktop\Stylesheet Files\bar-0-48.gif"
width="48" height="150"/>
   </xsl:when>

   <xsl:when match="[@initcost='1']">
	<img src="c:\windows\desktop\Stylesheet Files\bar-green1.gif"
width="48" height="150"/>
   </xsl:when>

   <xsl:when match="[@initcost='2']">
	<img src="c:\windows\desktop\Stylesheet Files\bar-green2.gif"
width="48" height="150"/>
   </xsl:when>

   <xsl:when match="[@initcost='3']">
	<img src="c:\windows\desktop\Stylesheet Files\bar-green3.gif"
width="48" height="150"/>
   </xsl:when>

   <xsl:otherwise>
	<img src="c:\windows\desktop\Stylesheet Files\bar-0-48.gif"
width="48" height="150"/>
   </xsl:otherwise>

</xsl:choose>

</xsl:template>

When I use this stylesheet, it always loads only the first image without
even considering what the XML attribute values are.  Here's an XML snippet
that I'm referencing:

<ELEMENT initcost="1" />

Why is this?



Justin Foster 
IT Architecture
253-596-3260 office
253-223-3108 mobile


 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]