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

Don't display table part if element not present ????

Hello and please forgive my newbieness,

Say I have one section of xml like this with 3 elements and the
following has 4 elements;

<deploy_info>
<datatype1>ADCP Velocity measurements</datatype1>
<datatype2>ADCP Temperature</datatype2>
<datatype3>ADCP Performance Data</datatype3>
</deploy_info>
<deploy_info>
<datatype1>ADCP Velocity measurements</datatype1>
<datatype2>ADCP Temperature</datatype2>
<datatype3>ADCP Performance Data</datatype3>
<datatype4>Seabird Microcat Data</datatype4>
<deploy_info>

And I have a table like such;

<table>
<tr>
<td><xsl:value-of select="datatype1"/></td>
</tr>
<tr>
<td><xsl:value-of select="datatype2"/></td>
</tr>
<tr>
<td><xsl:value-of select="datatype3"/></td>
</tr>
<tr>
<td><xsl:value-of select="datatype4"/></td>
</tr>
</table>

Assuming I already know how to do the xsl:for-each. How or can I even
tell xsl to not display the <trthrough </trfor <datatype4if it is
the first group that is selected for writing?

Thanks for any ideas on this,
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 8 '06 #1
6 1313
Patrick wrote:
<deploy_info>
<datatype1>ADCP Velocity measurements</datatype1>
<datatype2>ADCP Temperature</datatype2>
<datatype3>ADCP Performance Data</datatype3>
</deploy_info>
<deploy_info>
<datatype1>ADCP Velocity measurements</datatype1>
<datatype2>ADCP Temperature</datatype2>
<datatype3>ADCP Performance Data</datatype3>
<datatype4>Seabird Microcat Data</datatype4>
<deploy_info>

And I have a table like such;

<table>
<tr>
<td><xsl:value-of select="datatype1"/></td>
</tr>
<tr>
<td><xsl:value-of select="datatype2"/></td>
</tr>
<tr>
<td><xsl:value-of select="datatype3"/></td>
</tr>
<tr>
<td><xsl:value-of select="datatype4"/></td>
</tr>
</table>

Assuming I already know how to do the xsl:for-each. How or can I even
tell xsl to not display the <trthrough </trfor <datatype4if it is
the first group that is selected for writing?
It might suffice to iterate over all child elements (XPath *) e.g.

<xsl:for-each select="deploy_info">
<table>
<tbody>
<xsl:for-each select="*">
<tr><td><xsl:value-of select="."/></td></tr>
</xsl:for-each>
</tbody>
</table>
</xsl:for-each>

Then there is xsl:if e.g.

<xsl:if test="datatype4">
<tr><td><xsl:value-of select="datatype4"/></td></tr>
</xsl:if>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 8 '06 #2
Martin Honnen wrote:
Patrick wrote:
> <deploy_info>
<datatype1>ADCP Velocity measurements</datatype1>
<datatype2>ADCP Temperature</datatype2>
<datatype3>ADCP Performance Data</datatype3>
</deploy_info>
<deploy_info>
<datatype1>ADCP Velocity measurements</datatype1>
<datatype2>ADCP Temperature</datatype2>
<datatype3>ADCP Performance Data</datatype3>
<datatype4>Seabird Microcat Data</datatype4>
<deploy_info>

And I have a table like such;

<table>
<tr>
<td><xsl:value-of select="datatype1"/></td>
</tr>
<tr>
<td><xsl:value-of select="datatype2"/></td>
</tr>
<tr>
<td><xsl:value-of select="datatype3"/></td>
</tr>
<tr>
<td><xsl:value-of select="datatype4"/></td>
</tr>
</table>

Assuming I already know how to do the xsl:for-each. How or can I even
tell xsl to not display the <trthrough </trfor <datatype4if it
is the first group that is selected for writing?


It might suffice to iterate over all child elements (XPath *) e.g.

<xsl:for-each select="deploy_info">
<table>
<tbody>
<xsl:for-each select="*">
<tr><td><xsl:value-of select="."/></td></tr>
</xsl:for-each>
</tbody>
</table>
</xsl:for-each>

Then there is xsl:if e.g.

<xsl:if test="datatype4">
<tr><td><xsl:value-of select="datatype4"/></td></tr>
</xsl:if>
Thanks for the pointer. That second one looks more intuitive to me. Is
there an advantage or disadvantage between the methods?

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 8 '06 #3
the first group that is selected for writing?

I'm not entirely sure what that phrase is intended to mean in this
context. Could you give us a more specific example?

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Nov 9 '06 #4
Joe Kesselman wrote:
>the first group that is selected for writing?


I'm not entirely sure what that phrase is intended to mean in this
context. Could you give us a more specific example?
Joe,

Doesn't matter now. I got it to work using an "if test=" told to me by
another poster. Thanks for asking though. I have to work on my xml
vocabulary so I can more clearly explain myself.

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 9 '06 #5
Patrick wrote:
have to work on my xml
vocabulary so I can more clearly explain myself.
A useful technique is to include a (small!) specific example of what
you're starting with, what you want out -- and if you're asking for
debugging assistance -- a (small!) runnable stylesheet that demonstrates
the problem and its erroneous output. That way, if someone's confused by
the description they can look at the code.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Nov 9 '06 #6
Joseph Kesselman wrote:
Patrick wrote:
> have to work on my xml vocabulary so I can more clearly explain myself.


A useful technique is to include a (small!) specific example of what
you're starting with, what you want out -- and if you're asking for
debugging assistance -- a (small!) runnable stylesheet that demonstrates
the problem and its erroneous output. That way, if someone's confused by
the description they can look at the code.
I'm pretty sure I did with the original post. But thanks for the reminder.

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 9 '06 #7

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

Similar topics

32
by: Rich | last post by:
I'm sure it sounds kinda nutty to display 200 columns and 500,000 rows of data. But I have been pulling data from a Lotus Notes database into Sql Server for a while now, but Lotus Notes is...
18
by: David Morris | last post by:
G'day. Is there a known "display:block;" problem in opera? In playing around trying to get some cross browser conformance, I either inadvertently or redundantly (depending on your perspective)...
1
by: Jon W | last post by:
This is a small table with hover on the table cells. The first cell is setup to switch from div element to input element by use of display:block/none. In IE, onclick the input element is displayed...
19
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the...
5
by: Patient Guy | last post by:
In my reading of the Strict and Transitional DTD for HTML 4.0, the table row (TR) elements are contained within table section elements: THEAD, TFOOT, and TBODY. The table section elements are...
4
by: bissatch | last post by:
I am trying to use DIV tags and a class to hide the DIV and the HTML within. I will use JavScript to change it from hidden to visible but that will come later. Below is the code I am using ...
7
by: parag1234567 | last post by:
Hi, I am dynamically generating a html file which will contain only <div> tags which contents are hidden from user( set by style="visibility:hidden") Now the next step is i am enabling some of...
7
by: stevewy | last post by:
I'm looking to manipulate/check the state of various checkboxes and radios in a form. Because I don't want to access all of the checkboxes in the form, only a specific section, I am trying to...
5
by: truptivk | last post by:
Hello all, I have a question and I'd be glad if any of you could help me :) I have written code to add rows dynamically to an existing table. When the user first comes to the page, there are 2...
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:
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...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.