Subject: [xsl] How to navigate the tree from a selected node to the root? From: Nirmala R <nirmala.r@xxxxxxxxxx> Date: Fri, 18 Oct 2002 17:15:58 +0530 |
Hello all, I have an xml doc <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="try.xsl"?> <books> <book name="name2"> <otherdetails price="10"/> </book> <book name="name1"> <otherdetails price="20"/> </book> </books> and an xsl for the above as: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml"/> <xsl:template match="/"> <xsl:for-each select="books/book/otherdetails[@price='10']"> <xsl:copy-of select="parent::*"/> </xsl:for-each> </xsl:template> </xsl:stylesheet> This gives the output as: <?xml version="1.0" encoding="UTF-8"?> <book name="name2"> <otherdetails price="10"/> </book> I want to get like this: <books> <book name="name2"> <otherdetails price="10"/> </book> </books> i.e. From this paricular selected node, i want to navigate till the root node and get the output. I will not know how many more ancestors are there to reach the root node. Can you please help me out for doing the same. Thanks in advance, Nirmala XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Functional Language wasRE: [xsl, Kurt Cagle | Thread | RE: [xsl] How to navigate the tree , Jarno . Elovirta |
RE: [xsl] What is the fastest XSLT , bryan | Date | RE: [xsl] What is the fastest XSLT , bryan |
Month |