Re: XSL choose problem

From: Dennis Myrén (dennis_at_oslokb.no)
Date: 03/01/05


Date: Tue, 1 Mar 2005 15:12:01 +0100

There is nothing wrong with that xslt:choose statement.
We would need to see the entire XSLT in order to find your problem here.
@ means attribute, so your XML should have an attribute named Code on the
Carrier node.

Byt the way, that xslt:choose you could replace entirely with something
like:
<img src="/graphics/global/{@Code}.gif" border="0"/>
assuming Code attribute contains the filename without extension, as it did
in your example.
Putting something into braces in an attribute is a short alternative to
xslt:value-of element.

-- 
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Phillippa Ritchie" <phillippar@ocs-consulting.com> wrote in message 
news:Ob0fIamHFHA.896@TK2MSFTNGP10.phx.gbl...
> Hi all
>
> I've not used XSL before and have been asked to change an existing file.
> An extract from the original is: (white space added for ease of reading)
>
> ...<xsl:template match="Trip">
> <table width="560" border="0" cellspacing="1" cellpadding="0"
> align="center">
> <tr valign="top" height="7">
> <td colspan="4">
> <img src="/graphics/global/spacer.jpg"/>
> </td>
> </tr>
>
> <tr valign="top" height="12">
> <td colspan="3" align="left" valign="bottom" class="TripHeader">
>
> <script>
> <xsl:attribute name="language">JavaScript1.1</xsl:attribute>
> <xsl:attribute name="src">http://a.site.com?value=
> select="Dep/Carrier/@Code"/>
> </xsl:attribute>
> //
> </script>
>
> </td>.....
>
> The script block needs to be changed to check the value of
> Dep/Carrier/@Code and output an image depending on the results. I've
> done the following:
>
> ..<xsl:template match="Trip">
> <table width="560" border="0" cellspacing="1" cellpadding="0"
> align="center">
> <tr valign="top" height="7">
> <td colspan="4">
> <img src="/graphics/global/spacer.jpg"/>
> </td>
> </tr>
>
> <tr valign="top" height="12">
> <td colspan="3" align="left" valign="bottom" class="TripHeader">
>
> <xsl:choose>
> <xsl:when test="Dep/Carrier/@Code='a'">
> <img src="/graphics/global/a.gif" border="0"/>
> </xsl:when>
>
> <xsl:when test="Dep/Carrier/@Code='b'">
> <img src="/graphics/global/b.gif" border="0"/>
> </xsl:when>
>
> <xsl:when test="Dep/Carrier/@Code='c'">
> <img src="/graphics/global/c.gif" border="0"/>
> </xsl:when>
> </xsl:choose>
>
> </td>...
>
> This is causing a problem. Unfortunately I don't have an error message.
> I's causing the custom error page to appear. The original works fine. I
> guess I am doing something in my test incorrectly but as i took
> Dep/Carrier/@Code from the original i assumed it would work. Also, I
> don't have any xml as it is created dynamically through the web page.
> Can anyone spot what I'm doing wrong? Also, could someone explain what
> the '@' is for? (I really am new to this!)
>
> Thanks for any help!
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it! 


Relevant Pages

  • XMLAnalysisError.8007007E - The specified module could not be found
    ... we have installed XML for Analysis version 1.0 on Windows 2003 Server, ... however we are getting the following error message when connecting from ... We have confirmed that MSXML 3.0 is installed on the server. ... There are no errors in the windows event log. ...
    (microsoft.public.data.xmlanalysis)
  • Re: Problem with Property Sheet
    ... makes this error message go away. ... The QFE unfortunately didn't solve this problem. ... I've no idea what might be causing this one. ... "Michael Reim" ...
    (microsoft.public.windowsce.platbuilder)
  • Re: ACTIVESYNC V4.1 WILL NOT MAXIMIZE
    ... Something that it's doing is causing that error and it's a very severe ... It could just be a corrupt DLL that's part of ActiveSync or even of ... All items sync flawlessly. ... whenever I disconnect my Dell AS puts out an error message. ...
    (microsoft.public.pocketpc.activesync)
  • FileSystemWatcher problem - multiple hits
    ... I am serializing an object to XML and writing it to disk. ... is causing me to process the change twice. ... notifications? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Persisted XML files cannot be opened...
    ... I got the same error message, when I try to load xml data into my Dataset. ... "Persisted XML files cannot be opened with the version of the Microsoft XML ... I suppose the problem is in some of hotfix of IE 6.xx or MSXML. ...
    (microsoft.public.vb.com)