RE: [xsl] xsl query to determine image

Subject: RE: [xsl] xsl query to determine image
From: "Onur Esnaf" <oesnaf@xxxxxxxxxxxxxxx>
Date: Fri, 23 May 2003 18:15:53 +0300
excuse me.
I couldn' find the new post link

I want to execute a SELECT DISTINCT querry in a node tree.

A have a node tree below

	<salesStaff>
		<person name="john" date="5/22/2003" time="10:00" duration="2" />
		<person name="john" date="5/22/2003" time="12:00" duration="1" />
		<person name="john" date="5/22/2003" time="13:00" duration="2" />
		<person name="marry" date="5/22/2003" time="12:00" duration="1" />
		<person name="bob" date="5/22/2003" time="9:00" duration="2" />
		<person name="bob" date="5/22/2003" time="11:00" duration="2" />
		<person name="john" date="5/22/2003" time="11:00" duration="2" />
		<person name="john" date="5/23/2003" time="10:00" duration="1" />
		<person name="jan" date="5/23/2003" time="10:00" duration="2" />
		<person name="sany" date="5/23/2003" time="19:00" duration="2" />
		<person name="marry" date="5/23/2003" time="15:00" duration="2" />
	</salesStaff>

	How can I have a query like "SELECT DISTINCT name FROM salesStaff WHERE date = today"
	This will return the names of the salesmen who has an appointment today.
	But each name must be returned only once.

Thanks.
Onur


-----Original Message-----
From: Philip Fitzsimons [mailto:pfitzsimons@xxxxxxxxxxx]
Sent: Friday, May 23, 2003 5:55 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: [xsl] xsl query to determine image


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


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread