472,782 Members | 1,086 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,782 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 6137
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...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.