|| Hi I have an xml like this:
|| <?xml version="1.0" ?>
|| <root>
|| <data_field1>value1</data_field1>
|| <data_field2>value1</data_field2>
|| <data_field3>value1</data_field3>
|| <data_field4>value1</data_field4>
|| </root>
|| I am trying to get back a string in the form:
|| "data_field1,data_field2,data_field3,data_field4"
|| Any help will be appreciated...
|| -Shishir
How about the xsl that does it? ;)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<!-- root template match -->
<xsl:template match="/root">
<xsl:text>"</xsl:text>
<!-- loop on each child of the current node (i.e. each
child of /root)
<xsl:for-each select="*">
<!-- get the local name of the element -->
<xsl:value-of select="local-name()"/>
<!-- insert a comma if it's not the last node
-->
<xsl:if test="position() != last()">
<xsl:text>,</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:text>"</xsl:text>
</xsl:template>
</xsl:stylesheet>
Hope that helps,
bRegards
Allan Jones
Tel: 0121 506 9111
Fax: 0121 506 9112
------------------------------------------------------------------------
----------------
HYFINITY LIMITED. Registered in England & Wales 4136884. Registered
Office:
Blythe Valley Innovation Centre, Central Boulevard, Blythe Valley Park,
Solihull, West Midlands, B90 8AJ. Tel: +44 (0)121 506 9111.
The information contained within this email, together with any
attachments,
is intended solely for the named recipient(s) and may contain privileged
and/or confidential information. If you receive this in error, please
notify
hyfinity limited immediately and delete this e-mail.
Any views or opinions represented in this e-mail are solely those of the
author and do not necessarily represent those of hyfinity or its
affiliate
companies.
Although this e-mail and its attachments have been scanned for the
presence
of computer viruses, hyfinity will not be liable for any losses as a
result
of any viruses being passed on.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list