Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: How I can query this xml file use XPATH expression?

From: Martin Honnen <mahotrash@-----.-->
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, '&#10;')"/>
   </xsl:template>

</xsl:stylesheet>




-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent