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

RE: xsl query to determine image

Subject: RE: xsl query to determine image
From: "Philip Fitzsimons" <pfitzsimons@xxxxxxxxxxx>
Date: Fri, 23 May 2003 15:54:58 +0100
harry beeby
Needs a dollar $ for the variable
<img src="{$unparsed-entity-uri('Image2')}" />

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Sawyer, Larry
Sent: 23 May 2003 15:42
To: 'XSL-List@xxxxxxxxxxxxxxxxxxxxxx'
Subject:  xsl query to determine image


I'm trying to write some xsl that will fill in a simple gif image given a
field value from the xml.  I have it working until I try and define which
image will be shown given the severity value (see where I put the comments).
I can't figure out how to define the image to be show given the severity
value.

Please help.

<?xml version="1.0"?>
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  version="1.0">

<xsl:template match="rootElement">
  <html>
    <head>
      <title>Curt OLTX</title>
    </head>
    <body bgcolor="white">
      <table width="300px">

        <xsl:apply-templates>
	  <xsl:sort select="site"/>
        </xsl:apply-templates>

      </table>
    </body>
  </html>
</xsl:template>

<xsl:template match="id">
  <xsl:variable name="tmpSite"><xsl:value-of select="site"/></xsl:variable>

  <xsl:choose>
    <xsl:when test="contains('DAL', substring($tmpSite,1,3)) or
contains('MKO', substring($tmpSite,1,3)) or contains('MRO',
substring($tmpSite,1,3))">

      <xsl:if test="contains('DAL1',$tmpSite)">
        <tr><td colspan="4" align="center"><b>Dallas</b></td></tr>
      </xsl:if>

      <xsl:if test="contains('MKO1',$tmpSite)">
        <tr><td colspan="4"
align="center"><br/><br/><b>Merrimack</b></td></tr>
      </xsl:if>

      <xsl:if test="contains('MRO1',$tmpSite)">
        <tr><td colspan="4"
align="center"><br/><br/><b>Marlboro</b></td></tr>
      </xsl:if>

<!-- This is the section where I'm having trouble.  Everything within the
comments section is breaking the xsl.  I did something similar for another
report where I defined the table background from the severity, but I can't
figure out how to do it in this report with the image -->

<xsl:template match="id">
  <xsl:param name="severity" />

  <xsl:variable name="unparsed-entity-uri">
    <xsl:choose>
      <xsl:when test="severity = 'MINOR'">Image2</xsl:when>
      <xsl:when test="severity = 'CRITICAL'">Image3</xsl:when>
      <xsl:otherwise>Image1</xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
       
   <td><xsl:value-of select="site"/><br>
	<img src="{unparsed-entity-uri('Image2')}" /> </br></td>   

<!-- End area that is breaking the report -->
      
    </xsl:when>
  </xsl:choose>

</xsl:template>

<xsl:template match="servletPath"/>


</xsl:stylesheet>

 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

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.