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

Dynamic Rows and Columns in XSL Table

Hi,

I am trying to create a table in XSL in which the number of columns depends on a given XML. For example, the XML below needs to have three columns, each with the title of the corresponding <Name> (but the number of columns needs to depend on the number of <FormulaValue> elements present a given XML).

I appreciate all help...I've been trying to figure this out for days.

Thank you,
Christine


XSL code:

[HTML]

<Step>
<FormulaValue>
<Name>CIP_FEED_PUMP_SPEED</Name>
<Display>false</Display>
<Value/>
<Real>75</Real>
<EngineeringUnits></EngineeringUnits>
</FormulaValue>

<FormulaValue>
<Name>CIP_XFER_PUMP_SPEED</Name>
<Display>false</Display>
<Value/>
<Real>35</Real>
<EngineeringUnits></EngineeringUnits>
</FormulaValue>

<FormulaValue>
<Name>FEED_FLOW_RATE</Name>
<Display>false</Display>
<Value/>
<Real>5.7</Real>
<EngineeringUnits></EngineeringUnits>
</FormulaValue>
</Step>

[/HTML]
Jun 13 '07 #1
1 6168
Dököll
2,364 Expert 2GB
Hello, Christine!

I believe you're off to a great start. I will include an old code here, you can strip it for own use. Took this in college many moons ago. Please also delete some of it. I am including it all so when you try it, it works:

XML

[HTML]
<?xml version="1.0"?>
<!-- File Name: apartmentlist.xml -->

<?xml-stylesheet type="text/xsl" href="ApartmentSearch.xsl"?>

<RENTALUNITS>
<LISTING>
<APARTMENT>Konner Ridge</APARTMENT>
<ADDRESS>23 Monroe St.</ADDRESS>
<PHONE>256-5533</PHONE>
<BEDROOMS>3</BEDROOMS>
<BATHS>2</BATHS>
<VACANCY>2</VACANCY>
</LISTING>
<LISTING>
<APARTMENT>Konner Ridge</APARTMENT>
<ADDRESS>23 Monroe St.</ADDRESS>
<PHONE>256-5533</PHONE>
<BEDROOMS>1</BEDROOMS>
<BATHS>1</BATHS>
<VACANCY>2</VACANCY>
</LISTING>
<LISTING>
<APARTMENT>River Side Apartments</APARTMENT>
<ADDRESS>400 St. Joe River Rd.</ADDRESS>
<PHONE>395-4474</PHONE>
<BEDROOMS>1</BEDROOMS>
<BATHS>1</BATHS>
<VACANCY>2</VACANCY>
</LISTING>
<LISTING>
<APARTMENT>White Oak Apartments</APARTMENT>
<ADDRESS>900 W. 111th St</ADDRESS>
<PHONE>398-4123</PHONE>
<BEDROOMS>2</BEDROOMS>
<BATHS>2</BATHS>
<VACANCY>1</VACANCY>
</LISTING>
<LISTING>
<APARTMENT>Moore Woods Apartments</APARTMENT>
<ADDRESS>200 N. 1st St.</ADDRESS>
<PHONE>695-0695</PHONE>
<BEDROOMS>2</BEDROOMS>
<BATHS>1</BATHS>
<VACANCY>2</VACANCY>
</LISTING>
<LISTING>
<APARTMENT>Rhodes Manner Apartments</APARTMENT>
<ADDRESS>1000 Welsh Ave</ADDRESS>
<PHONE>395-3305</PHONE>
<BEDROOMS>4</BEDROOMS>
<BATHS>2</BATHS>
<VACANCY>2</VACANCY>
</LISTING>
</RENTALUNITS>

[/HTML]

XSL

[HTML]
<?xml version="1.0"?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
Database search
<center>
<a href="Uhome.html"><img border="0" src="GoHome.bmp" alt="Click here to go home"></img></a>
<h2>Browse Availability</h2>
</center>
<xsl:for-each select="RENTALUNITS/LISTING">
<xsl:sort select="APARTMENT" />
<p>
<span style="font-style:italic; font-weight: 900; color: #ff6633">
<xsl:value-of select="ADDRESS" />
</span>
<xsl:text> </xsl:text>
<span style="font-variant:small-caps; font-weight:bold">
<xsl:value-of select="PHONE"/>
</span>
</p>
<p style="margin-left: 3%">
<span style="font-weight:bold">Number of Bedrooms/Baths </span>
<xsl:value-of select="BEDROOMS" /> bedrooms and <xsl:value-of select="BATHS"/> baths.
Number of vacancies:
<span style="font-style:italic; font-weight: bold; color:#009999">
<xsl:value-of select="VACANCY" />
</span>
</p>
</xsl:for-each>
</xsl:template>
</xsl:transform>
[/HTML]

Save these in the same folder, double click the XML file and see it come to life.

Hope this helps...

Dököll
Jun 14 '07 #2

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

Similar topics

1
by: Richard Hollenbeck | last post by:
Hello Newsgroup. You have all been very helpful in the past and I thank you. I try to ask relevant questions so that they don't just benefit me, but also benefit the group. I'm currently...
4
by: Bass Pro | last post by:
Hi, I am creating textbox, radiobuttonlist and checkboxlist dynamically depending on data from a table. It is a questionnaire. I add the control on a Panel control during the 1st load_page event....
7
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
2
by: dschectman | last post by:
This appears to be a feature of IE JavaScript. I am running IE 6.0 with the latest patches from Microsoft. Are there any workarounds other than re-coding the source HTML to place all the...
2
by: jainharsh | last post by:
Hi Guyz, I am trying to make a dynamic table which will automatically update after running a query. My Table contains 4 columns. I am trying to update the table by adding rows of information...
0
by: Eniac | last post by:
Hi, I've been working on a custom user control that needs to be modified and the validation is causing me headaches. The control used to generate a table of 4 rows x 7 columns to display all...
2
by: DaveL | last post by:
Hello I want to build Dynamic Paramers for a Sql Insert below is what i have so far but...determinthe column type and length im having Problems with Tks dave string sInsert = "Insert into...
0
LegalIT
by: LegalIT | last post by:
Hello, I am creating a Word table using a VB.net application. I have it working with the following declaration: Dim table As Word.Table = myRange.Tables.Add(myRange, intRowCount, 5) I...
0
by: JamesOo | last post by:
I have the code below, but I need to make it searchable in query table, below code only allowed seach the table which in show mdb only. (i.e. have 3 table, but only can search either one only,...
0
by: ebernon | last post by:
The Dynamic deletion of Rows and Columns within a program is frequently desired but often hard to obtain. The Help files for VB-6 contained within Excel 2002 (XP) don’t always provide the help you...
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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...
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: 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...
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...

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.