![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - How I can query this xml file use XPATH expression? [Thread Next] Re: How I can query this xml file use XPATH expression?To: NULL Date: 5/2/2008 12:28:00 PM lxmxn wrote: > The XML file is above, how can I query the informations (sorted by > 'FileSize') into this format: > 0,e:\tool\temp.xml > 9,e:\tool\run.bat > 220,247296,e:\tool\i.txt > 247296,e:\tool\gawk.exe I don't think a single XPath expression suffices, what you can do is write an XSLT stylesheet that sorts and extracts the data: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text"/> <xsl:template match="CIM"> <xsl:apply-templates select="INSTANCE"> <xsl:sort select="PROPERTY[@NAME = 'FileSize']/VALUE" data-type="number"/> </xsl:apply-templates> </xsl:template> <xsl:template match="INSTANCE"> <xsl:value-of select="concat(PROPERTY[@NAME = 'FileSize']/VALUE, ',', PROPERTY[@NAME = 'Name']/VALUE, ' ')"/> </xsl:template> </xsl:stylesheet> -- Martin Honnen http://JavaScript.FAQTs.com/ | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||
|
