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

Help with writing select data

Hi All,

I'm new to all this and I'm back for more help. I am working with global
variables. I'm trying to make my xls just display the data for the
defined <moorname>. In my example I am using the second set of elements
C10AB. I can get it to just show the <moornamebut then it wants to
write out all the values for both sets. How can I fix this.

I would like my output to look like this;

Moorname: C10AB
Moortype: moortype2
Latitude: lat2
Longitude: lon2
Start: start2
End: end2
Your help is greatly appreciated.

Patrick

I have this xml;

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="testglovar.xsl" ?>
<active_wfs>
<deployment>
<moorname>C10AA</moorname>
<moortype>moortype1</moortype>
<lat>lat1</lat>
<lon>lon1</lon>
<start>start1</start>
<end>end1</end>
</deployment>
<deployment>
<moorname>C10AB</moorname>
<moortype>moortype2</moortype>
<lat>lat2</lat>
<lon>lon2</lon>
<start>start2</start>
<end>end2</end>
</deployment>
</active_wfs>
And this xsl;

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="iso-8859-1"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>

<xsl:variable name="moorname" select="'C10AB'" >
<html>
<body>
<xsl:call-template name="show_moor">
<xsl:with-param name="moornameToSelect" />
</xsl:call-template>
</body>
</html>
</xsl:variable>

<xsl:template name="show_moor" match="/">
<xsl:param name="moornameToSelect" />
<xsl:for-each select="active_wfs/deployment">
<p>Moorname: <xsl:value-of select="$moorname " /></p>
<p>Moortype: <xsl:value-of select="moortype " /></p>
<p>Latitude: <xsl:value-of select="lat" /></p>
<p>Longitude: <xsl:value-of select="lon" /></p>
<p>Start: <xsl:value-of select="start" /></p>
<p>End: <xsl:value-of select="end" /></p>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>

--
Patrick A. Smith Assistant System Administrator
Ocean Circulation Group – USF - College of Marine Science
http://ocgweb.marine.usf.edu Phone: 727 553-3334

The trouble with doing something right the first time is that nobody
appreciates how difficult it was. - La Rochefoucauld
Nov 3 '06 #1
3 1301
Assuming I understand your request:
<xsl:call-template name="show_moor">
<xsl:with-param name="moornameToSelect" selct="$moorname"/>
</xsl:call-template>

You were forgetting to set the actual value of the parameter.
<xsl:for-each select="active_wfs/deployment[moorname=$moornameToSelect]">

Select all those deployments which have a moorname child whose contained
text value is the same as the value you passed in.


--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Nov 3 '06 #2
Joseph Kesselman wrote:
Assuming I understand your request:
<xsl:call-template name="show_moor">
<xsl:with-param name="moornameToSelect" selct="$moorname"/>
</xsl:call-template>

You were forgetting to set the actual value of the parameter.
<xsl:for-each select="active_wfs/deployment[moorname=$moornameToSelect]">

Select all those deployments which have a moorname child whose contained
text value is the same as the value you passed in.

Thanks, that's assuming that I understand what I am trying to do. Can
you give me a more concise example of how this would work as I am at the
point of great confusion here.

Patrick
--
Patrick A. Smith Assistant System Administrator
Ocean Circulation Group – USF - College of Marine Science
http://ocgweb.marine.usf.edu Phone: 727 553-3334

The trouble with doing something right the first time is that nobody
appreciates how difficult it was. - La Rochefoucauld

Nov 3 '06 #3
Patrick wrote:
I am working with global variables.
Sorry, I did misread your question. I should learn not to type when tired...
<xsl:variable name="moorname" select="'C10AB'" >
<html>
<body>
<xsl:call-template name="show_moor">
<xsl:with-param name="moornameToSelect" />
</xsl:call-template>
</body>
</html>
</xsl:variable>
This is a problem. You are simultaneously trying to set $moorname to the
literal string C10AB and to contain a Result Tree Fragment which is your
little <html>...</htmlblock. You can't do both; the variable can have
only one value, and according to the XSLT spec this block of code is an
error -- if the select attribute is specified, the content MUST be empty.

So your first step should be replace that with something legal. Get rid
of either the contents, or the select.
Next step: Decide what your calling sequence is supposed to be here. Are
you really trying to call the same template to build a result tree
fragment in a variable -- which then gets used only to extract the text
nodes back out of it, since that's the definition of value-of when
applied to an RTF -- and as the root template which attempts to use the
result of that variable? Think through what you're trying to do -- write
it out in English -- and then write the code to match it; what you've
got here really does not make any sense, independent of the
global-variable issue.
The parameter you're passing (moornameToSelect) is empty, and unused,

>
<xsl:template name="show_moor" match="/">
<xsl:param name="moornameToSelect" />
<xsl:for-each select="active_wfs/deployment">
<p>Moorname: <xsl:value-of select="$moorname " /></p>
<p>Moortype: <xsl:value-of select="moortype " /></p>
<p>Latitude: <xsl:value-of select="lat" /></p>
<p>Longitude: <xsl:value-of select="lon" /></p>
<p>Start: <xsl:value-of select="start" /></p>
<p>End: <xsl:value-of select="end" /></p>
</xsl:for-each>
</xsl:template>

</xsl:stylesheet>

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Nov 4 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
7
by: Munzilla | last post by:
Ok, I have an ASP page that I use to add several pieces of information to a database and also display that information in an edit mode. The problem is, when I use the page for edit, not all of the...
5
by: Craig Keightley | last post by:
Please help, i have attached my page which worksin IE but i cannnot get the drop down menu to fucntion in firefox. Any one have any ideas why? Many Thanks Craig ...
2
by: mark | last post by:
I've been working on an Access 2000 database for a couple of weeks now. I took a course in access about a year ago, a crash course, and I learned a ton, but I didn't touch Access for the year since...
1
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am...
2
by: -D- | last post by:
I'm taking my first stab at using xml, so please bear with my novice questions and understanding of xml. I'm trying to create an xml file that holds all my website navigation. If I understand...
15
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
47
by: Jo | last post by:
Hi there, I'm Jo and it's the first time I've posted here. I'm in process of creating a database at work and have come a little unstuck.....I'm a bit of a novice and wondered if anyone could...
4
by: Debbiedo | last post by:
My software program outputs an XML Driving Directions file that I need to input into an Access table (although if need be I can import a dbf or xls) so that I can relate one of the fields...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.