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

Sibling access in XSL !

Subject: Sibling access in XSL !
From: "rajasekhar v" <bigfundu@xxxxxxxxxxx>
Date: Fri, 24 Sep 2004 03:27:14 +0530
xsl sibling
Hi,

I have got a simple XML like this which has some information about fruits

----------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" standalone ="yes"?>
<FRUIT>
<IDENTIFICATION>
  <NAME>APPLE</NAME>
</IDENTIFICATION>

<APPEARANCE>
  <COLOR>RED</COLOR>
</APPEARANCE>

<STORAGE>
  <TEMP>STORE APPLES UNDER 20 DEGREE</TEMP>
</STORAGE>

<IDENTIFICATION>
  <NAME>GRAPE</NAME>
</IDENTIFICATION>

 <APPEARANCE>
  <COLOR>BLACK</COLOR>
</APPEARANCE>

<STORAGE>
  <TEMP>STORE GRAPES UNDER 30 DEGREE</TEMP>
</STORAGE>

</FRUIT>
----------------------------------------------------------------------------------------------------


When i ran the above XML with the following XSL and Xalan parser,


----------------------------------------------------------------------------------------------------
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="FRUIT">
<HTML>
<HEAD><TITLE>XSL TEST</TITLE></HEAD>
<BODY>
<TABLE>
<xsl:apply-templates select="IDENTIFICATION"/>
<xsl:apply-templates select="APPEARANCE"/>
<xsl:apply-templates select="STORAGE"/>
</TABLE>
</BODY>
</HTML>
</xsl:template>


 <xsl:template match="IDENTIFICATION">
   <TR><TD><xsl:value-of select="NAME"/></TD></TR>
 </xsl:template>

 <xsl:template match="APPEARANCE">
   <TR><TD><xsl:value-of select="COLOR"/></TD></TR>
 </xsl:template>

 <xsl:template match="STORAGE">
   <TR><TD><xsl:value-of select="TEMP"/></TD></TR>
 </xsl:template>
</xsl:stylesheet>
----------------------------------------------------------------------------------------------------


I got the output as :


----------------------------------------------------------------------------------------------------
APPLE
GRAPE
RED
BLACK
STORE APPLES UNDER 20 DEGREE
STORE GRAPES UNDER 30 DEGREE
----------------------------------------------------------------------------------------------------


But i need the output as



---------------------------------------------------------------------------------------------------- APPLE RED STORE APPLES UNDER 20 DEGREE

GRAPE
BLACK
STORE GRAPES UNDER 30 DEGREE
----------------------------------------------------------------------------------------------------
i.e the details of apples appearing first followed by grape.


Please let me the know the ways of doing this - to identify the following node and process accordingly.



Regards, Raj

_________________________________________________________________
Movies, music, celeb news. Stay in the loop. http://www.msn.co.in/cinema/ With MSN Entertainment!



--+------------------------------------------------------------------ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/ or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx> --+--

Current Thread

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
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.