Subject: RE: [xsl] check for-each if a child exist and make loop for this too From: "Bondarenko, Taras" <TBondarenko@xxxxxxxx> Date: Sat, 26 Mar 2005 10:08:50 -0500 |
You question is not clear as well as your XML or output format you seek. If your XML is a list of <Jobdetail> nodes with children like <secondnode>, <thirdnode> etc I.e.: <root> <Jobdetails> <secondnode> <tag1>a</tag1> </secondnode> <thirdnode> <ta>4567</ta> </thirdnode> </Jobdetails> <Jobdetails> <secondnode> <tag1>a</tag1> </secondnode> <thirdnode> <ta>4567</ta> </thirdnode> </Jobdetails> ... </root> Then it's trivial to use pull or push template (for-each or apply-template) on <Jobdetails> node. i.e.: <xsl:for-each select="Jobdetails"> <xsl:value-of select="name(child::*[1])"/> </xsl:for-each> Or any of the XPaths: "following-sibling::*" or "following-sibling::node()" If <secondnode> is a sibling of the same root node as <Jobdetails> (they are sister nodes) and you know they follow in that order then you can use just "following" axis i.e. name(following::*) -----Original Message----- From: henry human [mailto:henry_human@xxxxxxxx] Sent: Saturday, March 26, 2005 7:47 AM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] check for-each if a child exist and make loop for this too in a for-each loop i know only the name of the first node(jobdetails) the second node(secondnode) could exist or maybe not. (it has second position of Jobdetails). how could i get the name of secound node and make a for-each loop for this one? xml --- </Jobdetails"> <secondnode> <tag1>a</tag1> <tag2>aa</tag2> <tag3>aaaaa</tag3> </secondnode> <thirdnode> <ta>4567</ta> <tb>67890</tb> <tc>ddd</tc> </thirdnode> </Jobdetails> ___________________________________________________________ Gesendet von Yahoo! Mail - Jetzt mit 250MB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] <b> in xsl, António Mota | Thread | [xsl] How do send ?, T UmaShankari |
Re: [xsl] <b> in xsl, António Mota | Date | Re: [xsl] Grouping elements, Marcos Hercules dos |
Month |