473,382 Members | 1,766 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,382 software developers and data experts.

Newbie, how do you stop an entity from appearing if it is blank/null?

I would like to stop this from being shown?

<metadata name="REFERENCE_NUMBER" ordering="1"><xsl:value-of select="Reference"/></metadata>

How do you stop it being outputted if it is blank?

Many thanks

Tino
Oct 4 '07 #1
3 1448
Dököll
2,364 Expert 2GB
I would like to stop this from being shown?

<metadata name="REFERENCE_NUMBER" ordering="1"><xsl:value-of select="Reference"/></metadata>

How do you stop it being outputted if it is blank?

Many thanks

Tino
I will keep searching for you but how about making sure there are no blanks in the first place. If you're interested, you can use this option. Will keep searching my library for more options:

[HTML]

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>
<card title="Input">
<p>
Name: <input name="name" size="15"/><br/>
Age: <input name="age" size="15" format="*N"/><br/>
Sex: <input name="sex" size="15"/>
</p>
</card>
</wml>

http://www.w3schools.com/wap/tag_input.asp

[/HTML]

In a bit!
Oct 4 '07 #2
Dököll
2,364 Expert 2GB
I will keep searching for you but how about making sure there are no blanks in the first place. If you're interested, you can use this option. Will keep searching my library for more options:

[HTML]

<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">

<wml>
<card title="Input">
<p>
Name: <input name="name" size="15"/><br/>
Age: <input name="age" size="15" format="*N"/><br/>
Sex: <input name="sex" size="15"/>
</p>
</card>
</wml>

http://www.w3schools.com/wap/tag_input.asp

[/HTML]

In a bit!
I found what I wanted to get you:

HTML/JavaScript

[HTML]

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Find a Movie</title>
</head>
<body>
<xml id="dsovideo" src="video-year.xml"></xml>
<p align="center">
<a href="index.htm"><img border="0" src="logo.gif" alt="Home" /></a></p>
<p></p>
<p style="font-size:24px; color: #336666; font-weight:900">Find a Movie by Title</p>
<p>Movie Title:<input type="text" id="searchtext" size="20" onKeyPress="keyPressed()">&nbsp;
<button onClick="findMovie()">search</button>
</p>
<hr size="5" color="#cccccc"/>
<div id="searchresult">
Results:
</div>
<script type="text/javascript">
<!--hide from old browsers
function keyPressed(k) {
var hitEnter=event.keyCode
if (hitEnter==13) findMovie()
}

function findMovie() {
searchstring = searchtext.value.toUpperCase()
if (searchstring=="") {
searchresult.innerHTML = "<b>&ltPlease enter a movie title in the text box.&gt</b>"
return
}
dsovideo.recordset.moveFirst()
var outputresult=""
while (!dsovideo.recordset.EOF) {
namestring = dsovideo.recordset("Title").value
if (namestring.toUpperCase().indexOf(searchstring)>=0 )
outputresult += "<b>" + dsovideo.recordset("Title")+"</b> ("+dsovideo.recordset("Year")+")</p>"
+ "<p style='margin-left:25px'><b>Rating: </b>"+dsovideo.recordset("Rating")+"</p>"
+ "<p style='margin-left:25px'><b>Starring: </b>"
+ dsovideo.recordset("Actor_Male") +", "
+ dsovideo.recordset("Actor_Female")
+ "<br /></p>"
dsovideo.recordset.moveNext()
}
if (outputresult=="")
searchresult.innerHTML = "&ltSorry, this movie title is currently not available.&gt"
else
searchresult.innerHTML = outputresult
}
//-->
</script>
<hr size="5" color="#cccccc" />
<p></p>
<b><font size="-1">Please send any comments to <a href="mailto:you@thisOrthat.com">you@thisOrthat.co m</a>.</font></b>
</body>
</html>

[/HTML]




XML

[HTML]

<?xml version="1.0"?>
<!-- File Name: video.xml -->
<?xml-stylesheet type="text/xsl" href="video-year.xsl"?>
<video>
<movie>
<Year>1996</Year>
<Title>Mission: Impossible</Title>
<Director>Brian De Palma</Director>
<Type>Action</Type>
<Actor_Male>Tom Cruise</Actor_Male>
<Actor_Female>Emmanuelle Beart</Actor_Female>
<Time>110</Time>
<Rating>PG-13</Rating>
</movie>
<movie>
<Year>2000</Year>
<Title>Cast Away</Title>
<Director>Robert Zemeckis</Director>
<Type>Adventure</Type>
<Actor_Male>Tom Hanks</Actor_Male>
<Actor_Female>Helen Hunt</Actor_Female>
<Time>143</Time>
<Rating>PG-13</Rating>
</movie>
<movie>
<Year>2004</Year>
<Title>Pirates of the Caribbean</Title>
<Director>Gore Verbinski</Director>
<Type>Adventure</Type>
<Actor_Male>Johnny Depp</Actor_Male>
<Actor_Female>Keira Knightley</Actor_Female>
<Time>143</Time>
<Rating>PG-13</Rating>
</movie>
<movie>
<Year>2001</Year>
<Title>The Mummy Returns</Title>
<Director>Stephen Sommers</Director>
<Type>Adventure</Type>
<Actor_Male>Brendan Fraser</Actor_Male>
<Actor_Female>Rachel Weisz</Actor_Female>
<Time>129</Time>
<Rating>PG-13</Rating>
</movie>
<movie>
<Year>2004</Year>
<Title>Bourne Supremacy</Title>
<Director>Paul Greengrass</Director>
<Type>Adventure</Type>
<Actor_Male>Matt Damon</Actor_Male>
<Actor_Female>Franka Potente</Actor_Female>
<Time>139</Time>
<Rating>PG-13</Rating>
</movie>
<movie>
<Year>1999</Year>
<Title>Being John Malkovich</Title>
<Director>Spike Jonze</Director>
<Type>Comedy</Type>
<Actor_Male>John Malkovich</Actor_Male>
<Actor_Female>Catherine Keener</Actor_Female>
<Time>112</Time>
<Rating>R</Rating>
</movie>
<movie>
<Year>2004</Year>
<Title>Home on the Range</Title>
<Director>Will Finn</Director>
<Type>Comedy</Type>
<Actor_Male>G.W. Bailey</Actor_Male>
<Actor_Female>Roseanne</Actor_Female>
<Time>76</Time>
<Rating>PG</Rating>
</movie>
<movie>
<Year>2001</Year>
<Title>Shrek</Title>
<Director>Andrew Adamson</Director>
<Type>Comedy</Type>
<Actor_Male>Mike Myers</Actor_Male>
<Actor_Female>Cameron Diaz</Actor_Female>
<Time>89</Time>
<Rating>PG</Rating>
</movie>
</video>

[/HTML]



XSL

[HTML]

<?xml version="1.0"?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<center>
<a href="index.htm"><img border="0" src="logo.gif"></img></a>
<h2>Bell Video - Browse by Year</h2>
</center>
<xsl:for-each select="video/movie">
<xsl:sort select="Year" data-type="number" />
<p>
<span style="font-style:italic; font-weight: 900; color: #ff6633">
<xsl:value-of select="Year" />
</span>
<xsl:text> </xsl:text>
<span style="font-variant:small-caps; font-weight:bold">
<xsl:value-of select="Title" />
</span>
</p>
<p style="margin-left: 3%">
<span style="font-weight:bold">Starring </span>
<xsl:value-of select="Actor_Male"/> and <xsl:value-of select="Actor_Female"/>.
This movie has a rating of
<span style="font-style:italic; font-weight: bold; color:#009999">
<xsl:value-of select="Rating"/>
</span>
</p>
</xsl:for-each>
</xsl:template>
</xsl:transform>

[/HTML]

Submitted this for school projects and I know it works. Try it, you should have no null returned...

Please let us know if that works nonetheless.

In a bit!
Oct 4 '07 #3
jkmyoung
2,057 Expert 2GB
Add an <xsl:if> statement around it:
Expand|Select|Wrap|Line Numbers
  1. <xsl:if test="Reference != ''">
  2. <metadata name="REFERENCE_NUMBER" ordering="1"><xsl:value-of select="Reference"/></metadata>
  3. </xsl:if>
Oct 4 '07 #4

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

Similar topics

1
by: Gary | last post by:
For some reason my GUI is just not appearing, it just appears as a blank screen. Any ideas?
2
by: Emily Jones | last post by:
That subject line will have Joe Celko apoplectic!! Let's say I have this thing. Oh, I don't know, a car. No, a vehicle. Can we agree that is an entity type? Some attributes might be VIN, Fuel,...
6
by: Martin Smith | last post by:
How can I stop ASP.NET Encoding things automatically? e.g if I create a button in my code and add the following attribute objNewButton.Attributes.Add("onClick",...
0
by: netflex | last post by:
Working on a handed off C# project and pretty much my third time dipping into C#. In my solution file, I have a collection of .resx files in their own folder, several .cs files, and my winforms .cs...
1
by: rengaraj | last post by:
JBoss version:4.0.4 Hibernate version:3.2 Database:Oracle10g Hi. I am facing an entity mapping problem. I have an Oracle stored function which takes as a parameter an Oracle array and returns a...
9
by: Max | last post by:
Hello! I would want to know if attributes values can be entity references and if the parser, during processing, can replace with blank string a non registered entity. Eg: <example...
3
by: castor. | last post by:
hi all, i have two tables BOOK ------------------------------------ CODE NOT NULL NUMBER TITLE VARCHAR2(45) YEAR NUMBER
3
by: Maverick6197 via AccessMonster.com | last post by:
I have a command button on my form which opens the standard windows dialog box and allows you to choose a file. After picking a file, the transferspreadsheet method is ran. This pulls data into a...
33
by: Adam Chapman | last post by:
Hi, Im trying to migrate from programming in Matlab over to C. Im trying to make a simple function to multiply one matrix by the other. I've realised that C can't determine the size of a 2d...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.