XSL group [modified]
-
Hi. How can I group values in "Type" ( xmldatasource - fill dropdownlist with distinct values ) ? XSL: <?xml version="1.0"?> <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msxsl="urn:schemas-microsoft-com:xslt" > <xsl:strip-space elements="*"/> <xsl:output method="xml" omit-xml-declaration="yes" indent="yes" standalone="yes" /> <xsl:template match="/"> <xsl:for-each select="dataroot"> <xsl:element name="dataroot"> <xsl:for-each select="Table_A"> <xsl:element name="Table_A"> <xsl:attribute name="Type"> <xsl:value-of select="Type"/> </xsl:attribute> </xsl:element> </xsl:for-each> </xsl:element> </xsl:for-each> </xsl:template> </xsl:transform> XML: <dataroot xmlns:od="urn:schemas-microsoft-com:officedata" generated="2009-10-21T09:21:31"> <Table_A> <ID_I>100085004</ID_I> <Type>GPS</Type> <Value>0</Value> <SDD_Date>1829-06-12T00:00:00</SDD_Date> </Table_A> </dataroot> Thanks in advance !!
modified on Friday, October 23, 2009 3:43 AM
-
Hi. How can I group values in "Type" ( xmldatasource - fill dropdownlist with distinct values ) ? XSL: <?xml version="1.0"?> <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msxsl="urn:schemas-microsoft-com:xslt" > <xsl:strip-space elements="*"/> <xsl:output method="xml" omit-xml-declaration="yes" indent="yes" standalone="yes" /> <xsl:template match="/"> <xsl:for-each select="dataroot"> <xsl:element name="dataroot"> <xsl:for-each select="Table_A"> <xsl:element name="Table_A"> <xsl:attribute name="Type"> <xsl:value-of select="Type"/> </xsl:attribute> </xsl:element> </xsl:for-each> </xsl:element> </xsl:for-each> </xsl:template> </xsl:transform> XML: <dataroot xmlns:od="urn:schemas-microsoft-com:officedata" generated="2009-10-21T09:21:31"> <Table_A> <ID_I>100085004</ID_I> <Type>GPS</Type> <Value>0</Value> <SDD_Date>1829-06-12T00:00:00</SDD_Date> </Table_A> </dataroot> Thanks in advance !!
modified on Friday, October 23, 2009 3:43 AM
Clas, can you use XSLT 2.0 instead 1.0? (If you can control the XSLT engine you use, then switch to SAXON by M. Kaye, from the web-site, you can also download all you need for .NET reuse.) If so, and the so-called Muenchian method is your friend. All you need to know you will find here: http://www.jenitennison.com/xslt/grouping/muenchian.html[^] Best regards, Stefan