[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

NewBie:pls help

  • From: Priyanka Asija <priyanka@n...>
  • To: xml-dev@l...
  • Date: Fri, 24 Aug 2001 14:53:02 +0530

tr td help

Dear XMLers,

I have an xml file

<Parent>
<Child>
    <Child1>data</Child1>
    <Child2>data</Child2>
    <Child3>data</Child3>
    <Child4>data</Child4>
    <Child5>data</Child5>
    <Child6>data</Child6>

    <ProblemChild>
	    <Sibling1>Data of Sibling1</Sibling1>
	    <Sibling2>Data of Sibling2</Sibling2>
	    <Sibling3>Data of Sibling3</Sibling3>
	    <Sibling4>Data of Sibling4 </Sibling4>  (FIRST CHUNK OF
DATA)
	    <Sibling5>Data of Sibling5</Sibling5>

	    <Sibling1>Data of Sibling1</Sibling1>
	    <Sibling2>Data of Sibling2</Sibling2>
	    <Sibling3>Data of Sibling3</Sibling3>
	    <Sibling4>Data of Sibling4 </Sibling4>(SECOND CHUNK OF DATA)
	    <Sibling5>Data of Sibling5</Sibling5>

	    <Sibling1>Data of Sibling1</Sibling1>
	    <Sibling2>Data of Sibling2</Sibling2>
	    <Sibling3>Data of Sibling3</Sibling3>
	    <Sibling4>Data of Sibling4 </Sibling4>(THIRD CHUNK OF DATA)
	    <Sibling5>Data of Sibling5</Sibling5>

	    <Sibling1>Data of Sibling1</Sibling1>
	    <Sibling2>Data of Sibling2</Sibling2>
	    <Sibling3>Data of Sibling3</Sibling3>
	    <Sibling4>Data of Sibling4 </Sibling4>(FOURTH CHUNK OF DATA)
	    <Sibling5>Data of Sibling5</Sibling5> 
    </ProblemChild>
    
</Child>
</Parent>


and the corresponsing XSL,

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
  <html>
  <body>

<!--Trying to display the data in a table format--->

  <table border="1">
  	<tr>
    		<td>Child1</td>
    		<td>Child2</td>
    		<td>Child3</td>
    		<td>Child4</td>
    		<td>Child5</td>
    		<td>Child6</td>
    	</tr>
    	
    	<xsl:for-each select="Parent/Child" >
    	<tr>
    		<td><xsl:value-of select="Child1"/></td>
    		<td><xsl:value-of select="Child2"/></td>
    		<td><xsl:value-of select="Child3"/></td>
    		<td><xsl:value-of select="Child4"/></td>
    		<td><xsl:value-of select="Child5"/></td>
   		<td><xsl:value-of select="Child6"/></td>
    	</tr>
    	</xsl:for-each>
	
	
	<th>
		<h1>ProblemChild</h1>
	</th>

    	<tr>
		<td>Sibling1</td>
		<td>Sibling2</td>
		<td>Sibling3</td>
		<td>Sibling4</td>
		<td>Sibling5</td>
    	</tr>

<!-- here i want the siblings data to be displayed in table format--->
 	<xsl:for-each select="Parent/Child/ProblemChild">
 	      <tr>
	   	 <td><xsl:value-of select="Sibling1"/></td>
	   	 <td><xsl:value-of select="Sibling2"/></td>
	   	 <td><xsl:value-of select="Sibling3"/></td>
	   	 <td><xsl:value-of select="Sibling4"/></td>
	   	 <td><xsl:value-of select="Sibling5"/></td>
	      </tr>
	</xsl:for-each>
  
   </table>
   </body>
   </html>
</xsl:template>
</xsl:stylesheet>	


Problem:

My Problem is that while trying to get the data out of the <Sibling>s of
<ProblemChild> tag, i get the data only of the first Chunk of tags that
is from <Sibling1> to <Sibling5>, ie it does not loop through and get
next set of data for me.Only the first one appears in the table.

What i tried was

	<xsl:for-each select="Parent/Child/ProblemChild/Sibling1">
 	      <tr>
	   	 <td><xsl:value-of select="."/></td>
	</xsl:for-each>

and then i got the all the data for <Sibling1> in all chunks.

But then i dont get data properly placed, i will have to place all the
data in a new row each.

Is there any other alternative for getting all the data of Sibling1
(infact from all sibling tags) by looping through

Please help, i have gone through dozens of sites but not got solution to
my problem.

I am in desperate need........

Thankyou in advance
XML Learner

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.