SunQuest
           XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old September 2nd, 2003, 12:46 PM
nihaarika2002 nihaarika2002 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 49 nihaarika2002 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
node contain multiple children in same sequence

Hi
Can anyone help me with this pls

-------------------------------------------

My xml

<PublicationList>
<Title> title1 </Title>
<Author>author1 </Author>
<Title> title2 </Title>
<Author>author2 </Author>
<Title> title3 </Title>
<Author>author3 </Author>
<Title> title4 </Title>
<Author>author4 </Author>
</PublicationList>
---------------------------------------------


and output shoud be

title1 - author1
title2 - author2
title3 - author3
title4 - author4
-------------------------------------
pls can anyone help me with this

if I use <xsl:appy templates select=”Title”/>

I get

title1
title2
title3
title4

and <xsl:appy templates select=”Author”/>

author1
author2
author3
author4


in separate sets
but I want

title1 - author1
title2 - author2
title3 - author3
title4 - author4

this format…
it may be very easy but being beginner I don’t know how to do that…so any help would be appreciated
thank u with regards
niha

Reply With Quote
  #2  
Old September 2nd, 2003, 11:47 PM
chinnman chinnman is offline
Fries w/ That?
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Kansas
Posts: 8 chinnman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
It will be easier to group your data in output if you wrap it on the input. Check out this modified XML:

<PublicationList>
<book>
<Title> title1 </Title>
<Author>author1 </Author>
</book>
<book>
<Title> title2 </Title>
<Author>author2 </Author>
</book>
<book>
<Title> title3 </Title>
<Author>author3 </Author>
</book>
<book>
<Title> title4 </Title>
<Author>author4 </Author>
</book>
</PublicationList>

Then you can write this XSL for output to HTML:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="html"/>
<xsl:template match="PublicationList">
<html>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="book">
<p>
<xsl:apply-templates/>
</p>
</xsl:template>
<xsl:template match="Title">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="Author">
<xsl:text> - </xsl:text>
<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>

Which will give you this output:
<html>
<body>
<p> title1 - author1 </p>
<p> title2 - author2 </p>
<p> title3 - author3 </p>
<p> title4 - author4 </p>
</body>
</html>

If you are looking for a modification of this process let me know.

Enjoy!

Chinnman!!

Reply With Quote
  #3  
Old September 3rd, 2003, 02:14 AM
nihaarika2002 nihaarika2002 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 49 nihaarika2002 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
thank u chinnman

hi
thank u chinnman
i will look into that. if i have any probs i sure will come back to u
thank u ever so much
with regards
niha

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > node contain multiple children in same sequence


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway