xml tag position change
Hi,
i have an xsl and xml,i need to replace the tag position from one location to another .
xsl:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="richtext">
<html>
<body>
<table align="center">
<tr>
<td width="800">
<xsl:for-each select="par[@def='2']">
<xsl:copy-of select="./node()" />
<br />
</xsl:for-each>
<xsl:for-each select="par[@def='3']">
<xsl:copy-of select="./node()" />
<br />
</xsl:for-each>
</td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
xml:
<richtext xmlns:sgx="http://www.lotus.com/dxl">
<pardef id="2"/>
<par def="2">
<run>
CapitaLand Limitedâs subsidiary</run>
</par>
<pardef id="3"/>
<par def="3">
<run>
</run>
</par>
<par def="3">
<run>
For details, please refer to the announcement and news release posted by CMTML on the SGX website </run>
<run>
www.sgx.com.sg</run>
</par>
<pardef id="4"/>
<par def="4">
<run>
Fashion plus
</run>
</par>
<par def="4" />
<par def="2">
<run>
some text</run>
</par>
<par def="2">
<run>
some text one</run>
</par>
<par def="2">
some text two
</par>
<par def="3">
<run>
some text three</run>
</par>
</richtext>
after transformation my html view is:
<richtext xmlns:sgx="http://www.lotus.com/dxl">
<pardef id="2"/>
<par def="2">
<run>
CapitaLand Limitedâs subsidiary</run>
</par>
<pardef id="3"/>
<par def="3">
<run>
</run>
</par>
<par def="3">
<run>
For details, please refer to the announcement and news release posted by CMTML on the SGX website </run>
<run>
www.sgx.com.sg</run>
</par>
<pardef id="4"/>
<par def="4">
<run>
Fashion plus
</run>
</par>
<par def="4" />
<par def="2">
<run>
some text</run>
</par>
<par def="2">
<run>
some text one</run>
</par>
<par def="2">
some text two
</par>
<par def="3">
<run>
some text three</run>
</par>
</richtext>
1)Is it possible to change the position of the tag
current :
<run>
some text three</run>
required:
<run>
some text three </run>
2)is is possible to display the order as it is in xml,as now it displays first with def=2 then def=3,my requirement is the order should be same as xml order.
Regards
Raj
Regards
RAJ
|