473,466 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

open HTML tags problem

I am new to XSL but I need to create a display where the layout is

<tr> <td> <item/ ></td> <td> <item/ ></td> </tr>
<tr> <td> <item/ ></td> <td> <item/ ></td> </tr>
and so on ..

A column table.

But inorder to this I am trying to do the following

<xsl:if test="position() mod 2 = 0">
<tr>
</xsl:if>

<xsl: something .. to add <td> <item/ ></td>

<xsl:if test="position() mod 2 = 0">
</tr>
</xsl:if>

But it wont let me use the open tag <tr>, is there a way around using
open tags. If not is there a solution to achieve what I am after ?

Jul 20 '05 #1
3 1294
re***@hotmail.com writes:
I am new to XSL but I need to create a display where the layout is

<tr> <td> <item/ ></td> <td> <item/ ></td> </tr>
<tr> <td> <item/ ></td> <td> <item/ ></td> </tr>
and so on ..

A column table.

But inorder to this I am trying to do the following

<xsl:if test="position() mod 2 = 0">
<tr>
</xsl:if>

<xsl: something .. to add <td> <item/ ></td>

<xsl:if test="position() mod 2 = 0">
</tr>
</xsl:if>

But it wont let me use the open tag <tr>, is there a way around using
open tags. If not is there a solution to achieve what I am after ?


XSLT never works with tags, it generates a node tree, and you can't
have half a node. Also more directly, the stylesheet has to be a well
formed XML document.

You want to start a new row every second item, and in that row you want
to process this node and the next, so code that directly in xslt
in terms of this node tree, nit in trems of tags that may be used if
this node tree is ever serialised:
<xsl:for-each select="*[position() mod 2 = 0]">
<tr>
<xsl:apply-templates select=".|following-sibling::*[1]"/>
</tr>
</xsl:for-each>

<xsl:template match="abc">
<td>
<xsl:apply-templates/>
</td>
</xsl:templates>

David
Jul 20 '05 #2
Thanks so producing a 5 column table would be impossible as you can't
get a sibling 5 items down?

Jul 20 '05 #3
re***@hotmail.com writes:
Thanks so producing a 5 column table would be impossible as you can't
get a sibling 5 items down?


???

you can select any number of siblings. I just showed 2 as that's
what you asked for.If you want 5 then

<xsl:for-each select="*[position() mod 5 = 0]">
<tr>
<xsl:apply-templates select=".|following-sibling::*[position()&lt;5]"/>
</tr>
</xsl:for-each>

<xsl:template match="abc">
<td>
<xsl:apply-templates/>
</td>
</xsl:templates>

David
Jul 20 '05 #4

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

Similar topics

2
by: Raptor | last post by:
I'm a complete Javascript n00b, using a snippet I found on the web. I'll probably be buying a Javascript book. What's the authoritative on-line resource for Javascript, like php.net is for PHP? ...
1
by: Nat | last post by:
Hi I have following code: ----------------- protected override void Render(HtmlTextWriter w) { if (helpString!=null) { w.Write("<span class='tooltipiconouter'><img title =...
6
by: Ludwig77 | last post by:
When I was first taught html several years ago, I was taught that the following tags are standard for any html formatted message: <HTML> <HEAD> </HEAD> </BODY> </HTML> In fact, I was taught...
8
by: alanstew | last post by:
With the body tag calling out 'window onload', a function with a 'window.open' fails at the 'window.open' line. If I cut out the body tag, the function executes as normal. At first I thought it...
3
by: TM360 | last post by:
I realize this may not be the right group to post this, but I'm not having much success elsewhere so I thought I'd give it a try... In our application we have a link that opens a new window...
18
by: Robert Bowen | last post by:
Hello peeplez. I have an odd problem. When I put the ANSI symbol for "less than" ("<"), the word STRONG and then the ANSI symbol for "greater than" (">") in my web page, followed by some text, then...
5
by: acord | last post by:
Hi, I m getting annoying display problem when placing javascript tags in a html page. Should the javasscript tags placed at the beginning of a html page before anything start? or placed between...
9
by: anupamjain | last post by:
Hi, After 2 weeks of search/hit-and-trial I finally thought to revert to the group to find solution to my problem.(something I should have done much earlier) This is the deal : On a JSP...
13
by: Bob Jones | last post by:
Here is my situation: I have an aspx file stored in a resource file. All of the C# code is written inline via <script runat="server"tags. Let's call this page B. I also have page A that contains...
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
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.