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

Xslt Help!!!

I am having trying to generate my fo document in the right structure. Basically what i want i 2 the following structure :

Expand|Select|Wrap|Line Numbers
  1. <table>
  2.  <row>
  3.   <cell>Item 1</cell>
  4.   <cell>item 2</cell>
  5.  </row>
  6. </table>
  7.  <table>
  8.  <row>
  9.   <cell>Item 3</cell>
  10.   <cell>Item 4</cell>
  11.  </row>
  12. </table>
The structure of my XML is as follows :

Expand|Select|Wrap|Line Numbers
  1. <root>
  2.  <contents>
  3.   <section id="99" name="Test">
  4.      <advert ref="2" /> 
  5.      <advert ref="1"/>
  6.      <advert ref="3"/>
  7.      <advert ref="4"/>
  8.   </section>
  9.  </contents>
  10. </root>
At the moment i have a template for contents which then displays a header, and a template for sections which applies an advert template which in turn calls a seperate document which displays the advert. I basically need 2 adverts per row. I used to do this by using "advert[position() mod 2] = 1" and "following-sibling::advert[1]" to display the next advert but because i am not passing parameters to the advert layout template anymore i cant do that. Does anyoehave any techniques for doing this as i have tried many ways... and failed!
Dec 20 '07 #1
1 1091
jkmyoung
2,057 Expert 2GB
You can probably do what you were doing before, could you post your xslt?

eg, I'm guessing the solution looks something like
Expand|Select|Wrap|Line Numbers
  1. <xsl:for-each select="advert[position() mod 2 = 1]">
  2.   <tr>
  3.     <xsl:apply-templates select="."/>
  4.     <xsl:apply-templates select="following-sibling::advert[1]"/>
  5.   </tr> 
  6. </xsl:for-each>
  7.  
Dec 20 '07 #2

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

Similar topics

6
by: Pete | last post by:
I am just getting to grips with XML and I was wondering if you could help me with something that no-one seems able or willing to help with.. I have an XSLT file which should be transforming a...
4
by: Brett conklin | last post by:
I have an xml document that I am trying to transform into HTML. This sounds straigt forward but the xml uses an format that I don't know how to xslt. Here is the format. <RESULTSET> <HIT>...
1
by: Mark Tranchant | last post by:
I'm struggling to find a way to achieve the following transformation: <x a="1" b="2" c="3" ... /> into <y b="2" c="3" ... > <z a="1" /> </y> In other words, I want to pull out a specific...
2
by: Bob | last post by:
I am having problems turning my xml into html for display. A sample xml file is given below, followed by my pathetic xslt attempt to transform it into html. A textual representation of what I was...
2
by: Ganesh Muthuvelu | last post by:
Hello, I have a XML like this below: ***************** <?xml version="1.0"?> <root> <row id="1" fname="Dan" lname="Wahlin"/> <row id="2" fname="Heedy" lname="Wahlin"/> <row id="3"...
6
by: Scott Zabolotzky | last post by:
I have the following XML sample: <Component Name="A"> <Param Name="OptionEnabled" DataType="boolean"> <Default>true</Default> </Param> <Param Name="Size" DataType="unsignedInt"/> <Param...
4
by: J | last post by:
I've spent most of the day on this, and I just can't seem to find a solution, please help me! :) I'm recieving XML that I can't modify that looks like: <?xml version="1.0"?> <Doc> <Page>...
2
by: Craig | last post by:
Hello there, I'm trying to generate a hyperlink (href) using XSLT to generate a web page that displays a table with selected information. At the moment everything is working except for the...
16
by: Bhavs | last post by:
How to convert a node value to lowercase??? I have <xsl:when test="//@locationName ='xyz'"> I have to convert the locationName to lowercase in the xslt page. Can I use the toLower function? ...
1
by: manugm1987 | last post by:
<p class=MsoNormal> <b style='mso-bidi-font-weight:normal'> <span style='font-size:12.0pt;line-height:115%'>Hello </span> </b> <i style='mso-bidi-font-style: normal'> <span...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.