Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: Utility to convert XML to value pair ? >Thread Next - Re: Utility to convert XML to value pair ? Re: Utility to convert XML to value pair ?To: NULL Date: 4/10/2008 10:29:00 PM dingdongdingding@y... wrote: > When I look closer at the XML, I realise that I myself had > misinterpreted my needs. Inside the XML, there is a portion where the > value are coded as (eg): > > <NameValuePair> > <name>Name</name> > <value>xxxxxxxxxxxxxxxxx</value> > </NameValuePair> > <NameValuePair> > <name>Address</name> > <value>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</ > value> > </NameValuePair> > <NameValuePair> > <name>Telephone</name> > <value>xxxxxxxx</value> > </NameValuePair> > <NameValuePair> > <name>Comments</name> > <value/> > </NameValuePair> > > Name=xxxxxxxxxxxxxxxxx > Address=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx > Telephone=xxxxxxxx > Comments= > > So are there any tools that can do this ? Thanks. Nothing prewritten -- how could a program guess what you want to do? But this XSLT script will do it. <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text"/> <xsl:strip-space elements="*"/> <xsl:template match="NameValuePair"> <xsl:value-of select="name"/> <xsl:text>=</xsl:text> <xsl:value-of select="value"/> <xsl:text>
</xsl:text> </xsl:template> </xsl:stylesheet> ///Peter | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
