Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 17th, 2008, 04:01 AM
Friend of Wrox
 
Join Date: Jan 2007
Location: durban, Africa, South Africa.
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
Default When <xsl:value-of select="Tooltip" /> = value

Hi, need help please!
I need to check for the value of <xsl:value-of select="Tooltip" />
and add it in <when>

<xsl:when test="@Tooltip != 'blank'"> <td>
   <xsl:element name="asp:label">
     <xsl:attribute name='id'>ttip_<xsl:value-of select='@name' /></xsl:attribute>
     <xsl:attribute name='runat'>server</xsl:attribute>
     <xsl:attribute name='text'><xsl:value-of select="Tooltip" /></xsl:attribute>
   </xsl:element>
  </td>
</xsl:when>

Thank You

  #2 (permalink)  
Old October 17th, 2008, 04:21 AM
Friend of Wrox
Points: 1,306, Level: 14
Points: 1,306, Level: 14 Points: 1,306, Level: 14 Points: 1,306, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2008
Location: Pondicherry, India
Posts: 291
Thanks: 9
Thanked 29 Times in 29 Posts
Default

Change <xsl:attribute name='text'><xsl:value-of select="Tooltip" /></xsl:attribute>
to
<xsl:attribute name='text'><xsl:value-of select="@Tooltip" /></xsl:attribute>
in your below code

Rummy
  #3 (permalink)  
Old October 17th, 2008, 04:23 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

You're not making yourself very clear. What exactly is your problem?

Your example looks fishy because the test asks about an attribute @Tooltip, while the body looks at a child element Tooltip. It seems unlikely that you have both.

What makes you use this verbose xsl:element/xsl:attribute notation, when you could write

<asp:label id="{ttip_@name}" runat="server" text="{@Tooltip}"/>

Are you paid by the line, perhaps?

Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
  #4 (permalink)  
Old October 17th, 2008, 04:43 AM
Friend of Wrox
 
Join Date: Jan 2007
Location: durban, Africa, South Africa.
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
Default

My friend - Thank You very much for the assistance.

Apologies I found a solution on my side - big thing for me, smal for you.

What I wanted to do was when the value = "blank" then display " " in the <td>. So i did this.

<td>
<xsl:if test="Tooltip != 'blank'">
<xsl:element name="asp:label">
     <xsl:attribute name='id'>ttip_<xsl:value-of select='@name' /></xsl:attribute>
     <xsl:attribute name='runat'>server</xsl:attribute>
     <xsl:attribute name='text'><xsl:value-of select="Tooltip" /></xsl:attribute>
</xsl:element>
</xsl:if>

<xsl:if test="Tooltip = 'blank'">
<xsl:element name="asp:label">
     <xsl:attribute name='id'>ttip_<xsl:value-of select='@name' /></xsl:attribute>
     <xsl:attribute name='runat'>server</xsl:attribute>
     <xsl:attribute name='style'>color:red;</xsl:attribute>
     <xsl:attribute name='text'> </xsl:attribute>
</xsl:element>
</xsl:if>
</td>

Thank You


Similar Threads
Thread Thread Starter Forum Replies Last Post
embedded <xsl:element> into <xsl:with-param> petergoodman XSLT 2 July 9th, 2008 06:36 AM
Performance for <xsl:import> and <xsl:include> vikkiefd XSLT 2 April 16th, 2008 08:06 AM
<xsl:for-each select="tokenize($indoc,'&#xA;')"> kapy_kal XSLT 4 June 9th, 2006 07:33 AM
<xsl:for-each> with a variable select="attribute" BeneathClouds XSLT 1 August 1st, 2005 03:36 AM
HELP: XSL -> HTML <select selected=true> jedbartlett XSLT 4 October 7th, 2004 11:16 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.