[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Sorting Problem with Xml and Xsl
I can not get this sorting to work. any help is greatly appreciated. I am
using MSXml parser and c# to transform. Thanks
Here is Sample XML ------------- <?xml-stylesheet type="text/xsl" href="rowextrated2.xsl" ?> <?mso-application progid='Excel.Sheet'?> <s:Workbook xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:s="urn:schemas-microsoft-com:office:spreadsheet"> <s:Worksheet s:Name="Sample1"> <s:Table> <s:Row> <s:Cell> <s:Data s:Type="String">Maa</s:Data> </s:Cell> </s:Row> <s:Row> <s:Cell> <s:Data s:Type="String">Baa</s:Data> </s:Cell> </s:Row> <s:Row> <s:Cell> <s:Data s:Type="String">Aaa</s:Data> </s:Cell> </s:Row> </s:Table> </s:Worksheet> <s:Worksheet s:Name="Sample2"> <s:Table> <s:Row> <s:Cell> <s:Data s:Type="String">Caa</s:Data> </s:Cell> </s:Row> <s:Row> <s:Cell> <s:Data s:Type="String">Qaa</s:Data> </s:Cell> </s:Row> <s:Row> <s:Cell> <s:Data s:Type="String">Zaa</s:Data> </s:Cell> </s:Row> </s:Table> </s:Worksheet> </s:Workbook> --------------My Xsl looks like this. But the problem is it does not take get me the sorted out . please check below <?xml version="1.0" encoding="utf-8" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s="urn:schemas-microsoft-com:office:spreadsheet" version="1.0"> <xsl:output method="xml" indent="yes" encoding="utf-16"/> <xsl:template match="s:Workbook"> <xsl:copy> <xsl:apply-templates> <xsl:sort data-type="text" select="s:Cell/s:Data" case-order="lower-first" /> </xsl:apply-templates> </xsl:copy> </xsl:template> <xsl:template match="*"> <xsl:copy> <xsl:apply-templates/> </xsl:copy> </xsl:template> </xsl:stylesheet> ---Desired output <?xml-stylesheet type="text/xsl" href="rowextrated2.xsl" ?> <?mso-application progid='Excel.Sheet'?> <s:Workbook xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:s="urn:schemas-microsoft-com:office:spreadsheet"> <s:Worksheet s:Name="Sample1"> <s:Table> <s:Row> <s:Cell> <s:Data s:Type="String">Aaa</s:Data> </s:Cell> </s:Row> <s:Row> <s:Cell> <s:Data s:Type="String">Baa</s:Data> </s:Cell> </s:Row> <s:Row> <s:Cell> <s:Data s:Type="String">Caa</s:Data> </s:Cell> </s:Row> </s:Table> </s:Worksheet> <s:Worksheet s:Name="Sample2"> <s:Table> <s:Row> <s:Cell> <s:Data s:Type="String">Maa</s:Data> </s:Cell> </s:Row> <s:Row> <s:Cell> <s:Data s:Type="String">Qaa</s:Data> </s:Cell> </s:Row> <s:Row> <s:Cell> <s:Data s:Type="String">Zaa</s:Data> </s:Cell> </s:Row> </s:Table> </s:Worksheet> </s:Workbook> _________________________________________________________________ Play Flexicon: the crossword game that feeds your brain. PLAY now for FREE. http://zone.msn.com/en/flexicon/default.htm?icid=flexicon_hmtagline
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|