Subject: How to select immediate preceding-sibling value
From: Arulraj <p_arulraj@xxxxxxxxx>
Date: Tue, 15 Nov 2005 04:09:41 -0800 (PST)
|
Hello,
I have following xml fragment as follows:
<?xml version="1.0" encoding="UTF-8"?>
<layout>
<Application name="Die application" level="1"/>
<Processgroup/>
<Process name="FSRenta" level="3"/>
<PanelName name="AnalysisLayout " level="4"/>
<frame name="Frame contents"/>
<PanelName name="GeneralLayout" level="4"/>
<Processgroup name="xxx" level="2"/>
<Process name="TestApplication" level="3"/>
<PanelName name="AnalysisLayout123" level="4"/>
<Application name="VDO" level="1"/>
</layout>
And i have following XSL to get the preceding-sibling
of PanelName.
<xsl:template match="layout">
<test>
<xsl:for-each select="child::*">
<xsl:if test="name()='PanelName'">
<xsl:text>current node--- </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>Preceding sibling---</xsl:text>
<xsl:value-of
select="current()/preceding-sibling::Process/@name"/>
<xsl:text>
</xsl:text>
</xsl:if>
</xsl:for-each>
</test>
</xsl:template>
I got the following output:
<test>
current node--- AnalysisLayout Preceding
sibling---FSRenta
current node--- GeneralLayoutPreceding
sibling---FSRenta
current node--- AnalysisLayout123Preceding
sibling---FSRenta
</test>
Here current node Panel Name is "AnalysisLayout123"
but it preceding sibling gets the "FSRenta". Why its
not refered to "TestApplication"?
But my expected output will be as follows:
<test>
current node--- AnalysisLayout Preceding
sibling---FSRenta
current node--- GeneralLayoutPreceding
sibling---FSRenta
current node--- AnalysisLayout123Preceding
sibling---TestApplication
</test>
any help..
Regards,
Raj
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
|