File: Data.xml
<?xml version="1.0" encoding="utf-8"?>
<citylist>
<distance city="A">1 HOURS</distance>
<distance city="B">2 HOURS</distance>
<distance city="C">30 MINUTES</distance>
<distance city="D">HOURS HOURS</distance>
<distance city="E">MINUTES MINUTES</distance>
</citylist>
File: Transform.xslt
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="citylist">
<TABLE>
<xsl:for-each select="distance">
<TR>
<TD>
<xsl:value-of select="@city"/>
<xsl:text>=</xsl:text>
<xsl:value-of select="substring-before(.,' ')"/>
<xsl:text/>
<xsl:value-of select="translate(substring-after(.,' '),'OURSINTE','oursinte')"/>
</TD>
</TR>
</xsl:for-each>
</TABLE>
</xsl:template>
</xsl:stylesheet>
Output:
<?xml version="1.0" encoding="UTF-8"?><TABLE><TR><TD>A=1Hours</TD></TR><TR><TD>B=2Hours</TD></TR><TR><TD>C=30Minutes</TD></TR><TR><TD>D=HOURSHours</TD></TR><TR><TD>E=MINUTESMinutes</TD></TR></TABLE>
|