Subject: [xsl] Read a parent node for particular chid using xsl From: Shashi.Bhushan@xxxxxxxxx Date: Wed, 24 Mar 2004 12:50:25 +0530 |
Hi I am working on a xml in which if parent node has a child nodes then it show's all the child nodes with their parent node title this is xml i am working on <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="search.xsl"?> <tree> <Result title='9.2.1 - Prepare Method abc Route Map' open='' save='' icon='Activity.gif' objectid='881E4C1C-3D0E-4061-B685-DDE185FC95B5' objecttype='7CC1B384-D273-45E0-83D9-75203AE52195' identifier='' exceptionicon='' > <ReferencedBy title='9 - Project Management (9.2 - Project Planning (9.2.1 - Prepare Method abc Route Map))' open='Phase_Overview\9_Phase_Overview.htm' nodeid='' releaseno='' categoryid='' categoryverno='' /> </Result> <Result title='Information Architecture in Method abc' open='Content\6.10\Accelerator\A0350.htm' save='' icon='sppt.gif' objectid='06D9262F-AB27-48FB-B434-09EC6C31A14F' objecttype='D6E0D253-7112-4D1C-B593-1470205A7A51' identifier='A0350' exceptionicon='' > <ReferencedBy title='1 - Situation Definition (1.2 - Baseline Internal Environment (1.2.11 - Understand Current Information Management Approach (Information Architecture in Method abc)))' open='Phase_Overview\1_Phase_Overview.htm' nodeid='' releaseno='' categoryid='' categoryverno='' /> <ReferencedBy title='3 - Solution Design (3.1 - High Level Solution Analysis & Design (3.1.7 - High Level Information Analysis & Design (Information Architecture in Method abc)))' open='Phase_Overview\3_Phase_Overview.htm' nodeid='' releaseno='' categoryid='' categoryverno='' /> </Result> <Result title='Method abc' open='' save='' icon='Meth.gif' objectid='BAB4C628-0F98-457F-81D4-5859FA25D20F' objecttype='6D62DB77-3630-45EF-BC0C-4596AEA76A65' identifier='' exceptionicon='' > </Result> <Result title='Method abc Product Information' open='Content\6.10\Accelerator\A0366.htm' save='' icon='sxls.gif' objectid='AADA6EEA-20AD-4E74-A74C-F5C1BBBA9E97' objecttype='D6E0D253-7112-4D1C-B593-1470205A7A51' identifier='A0366' exceptionicon='' > <ReferencedBy title='9 - Project Management (9.2 - Project Planning (9.2.2 - Product Based Planning (Method abc Product Information)))' open='Phase_Overview\9_Phase_Overview.htm' nodeid='' releaseno='' categoryid='' categoryverno='' /> <ReferencedBy title='Define Key Products (Method abc Product Information)' open='CDD\9_2_1_CD.htm' nodeid='' releaseno='' categoryid='' categoryverno ='' /> </Result> <Result title='Method abc Stage Level Route Template' open='Content\6.10\Template\T0379.htm' save='' icon='sdoc.gif' objectid='CEF77402-BBDE-4DD0-A613-DDF2CC723A5C' objecttype='F81C7D0E-4B46-45CC-BF5B-2F78792B7A41' identifier='T0379' exceptionicon='' > <ReferencedBy title='9 - Project Management (9.2 - Project Planning (9.2.2 - Product Based Planning (Input (Stage Level Route Map (Method abc Stage Level Route Template)))))' open='Phase_Overview\9_Phase_Overview.htm' nodeid='' releaseno='' categoryid='' categoryverno='' /> <ReferencedBy title='9 - Project Management (9.2 - Project Planning (9.2.1 - Prepare Method abc Route Map (Output (Stage Level Route Map (Method abc Stage Level Route Template)))))' open='Phase_Overview\9_Phase_Overview.htm' nodeid='' releaseno='' categoryid='' categoryverno='' /> <ReferencedBy title='9 - Project Management (9.2 - Project Planning (9.2.1 - Prepare Method abc Route Map (Method abc Stage Level Route Template)))' open='Phase_Overview\9_Phase_Overview.htm' nodeid='' releaseno='' categoryid='' categoryverno='' /> </Result> </tree> and the xsl that i used to display <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/tree"> <table border="1" cellpadding="0" cellspacing="0" class="search"> <thead> <tr> <th>Serial.No</th> <th class="tdborder" width="25%"><input name="display" type="button" class="submitSearch" onclick="javascript:sort('1')" value="Display" width="25%" /></th> <th class="tdborder" width="65%"><input name="reference" type ="button" class="submitSearch" onclick="javascript:sort('2')" value ="Referenced By" width="50%" /></th> <th class="tdborder" width="10%"><input name="identifier" type ="button" class="submitSearch" onclick="javascript:sort('3')" value="Identifier" width="25%" /></th> </tr> </thead> <tbody> <xsl:apply-templates select="Result//ReferencedBy"> <xsl:sort select="title"/> </xsl:apply-templates> </tbody> </table> </xsl:template> <xsl:template match="ReferencedBy"> <tr bgcolor="#00A6A6"> <td><xsl:value-of select="position()"/></td> <td class="tdborder" width="25%" > <a> <xsl:attribute name="href"> <xsl:if test="not(normalize-space(//Result//@open)) and not(normalize-space(//Result//@save)) "> ../../<xsl:value-of select="//Result//@open"/> </xsl:if> <xsl:if test="not(normalize-space(//Result//@save))"> <xsl:if test="substring(//Result//@open,0,5) ='http'"> <xsl:value-of select="//Result//@open"/> </xsl:if> <xsl:if test="substring(//Result//@open,0,5)! ='http'"> ../../<xsl:value-of select ="//Result//@open"/> </xsl:if> </xsl:if> <xsl:if test="string(//Result//@save)"> ../../<xsl:value-of select="//Result//@save"/> </xsl:if> </xsl:attribute> <xsl:value-of select="//Result/@title"/> </a> </td> <td class="tdborder" width="65%"> <a> <xsl:attribute name="href"> ../../<xsl:value-of select="@open"/> </xsl:attribute> <xsl:value-of select='@title'/> </a> </td> <td class="tdborder" width="10%" ><xsl:value-of select ="//Result//@identifier"/><xsl:text>   </xsl:text></td> </tr> </xsl:template> </xsl:stylesheet> I am not able to display the result as parent tile and child title in single row. Please help me Regards Shashi Bhushan * * * * XANSA CONFIDENTIALITY NOTICE * * * * This message is intended only for the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited, and you are requested to please notify us immediately by telephone, and return the original message to us at the above address. Xansa North America 5555 San Felipe # 695 Houston, TX 77056 888-820-3030 www.xansa.com
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Elminitate redundancy by , Kenny Akridge | Thread | Re: [xsl] Read a parent node for pa, Jeni Tennison |
RE: [xsl] Elminitate redundancy by , Jarno.Elovirta | Date | Re: [xsl] Variables and Values, Julian Voelcker |
Month |