N
naima.mans
Hello,
i want to select 2 following brothers nodes wich are one under another
(one closed to another)... i have done one xslt file... but it's not
really good..
for example:
the xml file:
-----------------------------------------------------
<loanService>
<tradePart product="L1712"> <!-- NOT this one -->
<positionInfo>
<position partyReference="EXPCFTCL"
code="CommitmentNetAmounts" /> <!-- this one -->
<position partyReference="EXPCFTCL"
code="CommitmentNetAmount" /> <!-- this one -->
</positionInfo>
</tradePart>
<tradePart product="L1712"> <!-- NOT this one -->
<positionInfo>
<positionRate>0.0000</positionRate> <!-- this one -->
<positionRate>20.0000</positionRate> <!-- this one -->
</positionInfo>
</tradePart>
</loanService>
-----------------------------------------------------
the XSLT:
--------------------------------------
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:diff="http://www.via.ecp.fr/~remi/soft/xml/xmldiff"
xmlns:msg="http://defiml.loanService.V3_40">
<xslutput method="text" encoding="ISO-8859-1" />
<xsl:strip-space elements="*" />
<xsl:template match="/">
<xsl:apply-templates select="//*"/>
</xsl:template>
<xsl:template match="//*">
<xsl:variable name="actual" select="."></xsl:variable>
<xsl:variable name="follow"
select="following-sibling::node()[position()=1]"></xsl:variable>
<xsl:if test="local-name($actual) = name($follow)">
<xsl:text> actual </xsl:text> <xsl:value-of
select="local-name($actual)"/>
<xsl:text>/ </xsl:text>
<xsl:text> follow </xsl:text><xsl:value-of select="name($follow)"
/>
<xsl:text> ; </xsl:text>
<xsl:text>
</xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
--------------------------------------
the result:
--------------------------------------
actual tradePart/ follow tradePart
;
actual position/ follow position ;
actual positionRate/ follow positionRate ;
--------------------------------------
The problem is that I want this result:
actual position/ follow position
;
actual positionRate/ follow positionRate ;
I just want to select the brother which are just one under another ...
thanks a lot
Tachi
i want to select 2 following brothers nodes wich are one under another
(one closed to another)... i have done one xslt file... but it's not
really good..
for example:
the xml file:
-----------------------------------------------------
<loanService>
<tradePart product="L1712"> <!-- NOT this one -->
<positionInfo>
<position partyReference="EXPCFTCL"
code="CommitmentNetAmounts" /> <!-- this one -->
<position partyReference="EXPCFTCL"
code="CommitmentNetAmount" /> <!-- this one -->
</positionInfo>
</tradePart>
<tradePart product="L1712"> <!-- NOT this one -->
<positionInfo>
<positionRate>0.0000</positionRate> <!-- this one -->
<positionRate>20.0000</positionRate> <!-- this one -->
</positionInfo>
</tradePart>
</loanService>
-----------------------------------------------------
the XSLT:
--------------------------------------
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:diff="http://www.via.ecp.fr/~remi/soft/xml/xmldiff"
xmlns:msg="http://defiml.loanService.V3_40">
<xslutput method="text" encoding="ISO-8859-1" />
<xsl:strip-space elements="*" />
<xsl:template match="/">
<xsl:apply-templates select="//*"/>
</xsl:template>
<xsl:template match="//*">
<xsl:variable name="actual" select="."></xsl:variable>
<xsl:variable name="follow"
select="following-sibling::node()[position()=1]"></xsl:variable>
<xsl:if test="local-name($actual) = name($follow)">
<xsl:text> actual </xsl:text> <xsl:value-of
select="local-name($actual)"/>
<xsl:text>/ </xsl:text>
<xsl:text> follow </xsl:text><xsl:value-of select="name($follow)"
/>
<xsl:text> ; </xsl:text>
<xsl:text>
</xsl:text>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
--------------------------------------
the result:
--------------------------------------
actual tradePart/ follow tradePart
;
actual position/ follow position ;
actual positionRate/ follow positionRate ;
--------------------------------------
The problem is that I want this result:
actual position/ follow position
;
actual positionRate/ follow positionRate ;
I just want to select the brother which are just one under another ...
thanks a lot
Tachi