how to get particular value [duplicate]
Possible Duplicate:
Extracting some data from XML
<block1>
<tag>
<name>59</name>
<value>/00940001812410930828 FONDITEL VALORES AV SAU ATAM PEDRO TEIXERIA 8 PLANTA 7A 28020MADRID
</value>
</tag>
</block1>
xslt
<xsl:for-each select="block4/tag[name ='59']">
<xsl:value-of select="value"/>,<xsl:text/>
</xsl:for-each>
is it corrected way writing like this ....because in my block so many tags are there so i need to call each开发者_高级运维 tag can any one help me
i need output like :
/00940001812410930828 , FONDITEL VALORES AV SAU ATAM PEDRO TEIXERIA 8 PLANTA 7A 28020MADRID
Your best bet would be to load the XML into an XML parser e.g. XDocument:
A sample code
XDocument xdoc = XDocument.Parse("SomeXml");
string Yourrequiredtag= xdoc.Descendants("requiredtag").First().Value;
Like this find all the required tags and display data
Try this articles
http://msdn.microsoft.com/en-us/library/ms256166.aspx
http://www.quackit.com/xml/tutorial/xslt_for-each.cfm
You're complaining that the code you are writing is repetitive. Well, when code looks repetitive, there's nearly always a way of abstracting it to avoid tedious repetition. This comes down to looking at the repetitive code, to see what's common and what can therefore be factored out. The problem is, you've only shown us one instance of your repetitive code. You haven't shown us enough data and enough code so that we can see the pattern emerging.
(XSLT 2.0 is better at this than 1.0. But even with 1.0, I once reduced a client's stylesheet from 1000 lines of code to 20 lines by rewriting it at a higher level of abstraction).
精彩评论