Subject: RE: [xsl] xsl query to determine image From: "Philip Fitzsimons" <pfitzsimons@xxxxxxxxxxx> Date: Fri, 23 May 2003 15:54:58 +0100 |
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] 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] xsl query to determine image, Sawyer, Larry | Thread | Re: [xsl] xsl query to determine im, David Carlisle |
Re: [xsl] Axis order and variables, David Carlisle | Date | RE: [xsl] xsl query to determine im, Onur Esnaf |
Month |