473,385 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Change a value in XSLT

Hello;

Okay i have a XSLT file but i want to know how i can change a value. One of the fields returns null sometimes and i want to put a if statement and state that if there is no value meaning null input a comment.

This is what my code looks like right now

Expand|Select|Wrap|Line Numbers
  1. <th align="left">Abstract <font size="2" face="Arial, Helvetica, sans-serif">
  2.    <xsl:value-of select="Abstract"/>
  3.      <xsl:if test="./Abstract = &quot;null&quot;">
  4.          <xsl:text> TEST </xsl:text> 
  5.       </xsl:if>
  6.    </font><br />
  7. </th>
This returns everything xml and outputs the information in Abstract and right after the word null it will output TEST how can i change it so that instead of having null TEST it just says test.

Can someone please help me out Thank you.
Dec 5 '07 #1
3 1681
jkmyoung
2,057 Expert 2GB
Expand|Select|Wrap|Line Numbers
  1. <xsl:choose>
  2.   <xsl:when test="./Abstract = 'null'">test</xsl:when>
  3.   <xsl:otherwise><xsl:value-of select="Abstract"/></xsl:otherwise>
  4. </xsl:choose>
  5.  
Dec 5 '07 #2
Thanks A Lot that worked great;

Also how can i change the content if it shows
null 2001

how can i take out the word null and leave 2001 in there?
so it says 2001 instead of null 2001 ?

Thank you
Dec 6 '07 #3
jkmyoung
2,057 Expert 2GB
Expand|Select|Wrap|Line Numbers
  1. <xsl:choose>
  2.   <xsl:when test="./Abstract = 'null'">test</xsl:when>
  3.   <xsl:when test="contains(./Abstract,'null')">
  4.     <xsl:value-of select="substring-before(Abstract,'null')"/>
  5.     <xsl:value-of select="substring-after(Abstract,'null')"/>
  6.   </xsl:when>
  7.   <xsl:otherwise><xsl:value-of select="Abstract"/></xsl:otherwise>
  8. </xsl:choose>
  9.  
Dec 6 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: inquirydog | last post by:
Hi- One frusterating thing for me with xsl is that I don't know how to make xslt throw some sort of exception when a value-of path does not exist. For instance, suppose I have the following...
1
by: mikea_59 | last post by:
I would like to use XSLT to translate some tagged value text to XML elements like this: Input Doc: <data>x=1.234 y=ABC z="Hello World"</data> Output Doc: <x>1.234</value>
1
by: David C. allen | last post by:
I have created a simple Client-side SOAP Extension for a webclass that I have. When I apply the extension attribute to the the calling function in the proxy class I get an error 'Value cannot be...
2
by: Rick | last post by:
I have an XML document that is generated from Infopath, I need to change the value of a namespace that is defined in a node in the form: <xsf:xDocumentClass "xmlns:my=valuehere">. when i navigate...
3
by: Frankie | last post by:
I'm writing a small utility app (C# Windows forms) used to create new ASP.NET Web sites. This utility needs to be able to change existing values in an existing Web.config. Please note: I do NOT...
8
by: patrizio.trinchini | last post by:
Hi All, I'would like to write an XSL transformation that changes the value of the atribute of a given element according to the value of another atttribute of the same element. For instance,...
0
by: shapper | last post by:
Hello, I am transforming a XML file into another XML file using a XSLT. Everything is working fine! I have only one problem: I want one of the values in my XSLT file to be taken from a Key...
4
by: nickjtew | last post by:
Hi, I need to change the output made by my xsl file depending on what ID is passed by the user in the browser. The user will need to click links, eg, http://xxx.com/blah.xml?articleid=245 ...
4
by: Hemal Pandya | last post by:
Hello, I am hoping this is a simple question with a straightforward solution. I do not understand xsl much, so I apologize in advance if I am asking a stupid question. Is it possible to write...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.