Click to See Complete Forum and Search --> : Test for a value


sylenceone
01-26-2009, 03:28 PM
Hi,

New to XML/XPath/XSLT and I have the following elements in my XML document:

<Field name="userpic"/>
<Field name="userpic" correctuser="Y"/>
<Field name="userpic">
http://intranet.dacgroup.com/images/userpics/100smd.jpg
</Field>

I want to:

a.) display a users' pic if there is one (done)
b.) don't display anything if there isn't one (done)
c.) display a image to upload your pic if there isn't one and correctuser = "Y" (not done)

Here is the part of my XSLT in question:

<xsl:choose>
<xsl:when test="Field[@name='userpic'][.!='']">
<img width="100" height="100">
<xsl:attribute name="src">
<xsl:value-of select="Field[@name='userpic']"/>
</xsl:attribute>
</img>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="Field[@name='userpic'][not(@correctuser)]">
None
</xsl:when>
<xsl:otherwise>
<a style="border:none;" href="http://intranet.dac-group.com/pic-upload.asp">
<img style="border:none;" src="http://intranet.dac-group.com/images/pic-add2.gif" alt="Upload your pic" title="Upload Your Pic" />
</a>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>

I can't seem to get the 2nd otherwise statement to work. Pretty sure there's an issue with my 2nd test statement, but not sure what it is. Any help would be appreciated. Thanks in advance.