[Home] [By Thread] [By Date] [Recent Entries]
Hi,
Now when everything else is working, and when I found the workaround to use Muenchian method in MSXML, I have one more issue. Currently, when grouping is performed, (see the structure of the XML below), if there is no attribute filter defined in Article element (see info=child in the third Document parent node), or if there is no value in the Article element, the group "child" will not be generated, instead the Article element will hang outside it's own group or directly in the root. I would like not to display all other elements (like the one in the XML examle below) that doesn't contain any value in the filter element, att all in the tree root. Thanx, -Mike In the following XSLT (current state) <?xml version='1.0' encoding='UTF-8'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:key name="by-info" match="Article" use="@info"/> <xsl:param name="filter" select="'food'"/> <xsl:template match="Documents"> <Documents> <xsl:for-each select="Document[@filter='' or @filter=$filter]/Article[generate-id()=generate-id(key('by-info',@info)[@filter='' or @filter=$filter])]"> <Document name="{@info}"> <xsl:copy-of select="key('by-info',@info)[@filter=$filter]"/> </Document> </xsl:for-each> </Documents> </xsl:template> </xsl:stylesheet> XML <?xml version="1.0" encoding="utf-8"?> <Documents> <Document chapter="1" title="title 1" href="file1.xml" filter="food"> <Article title="1.1" info="sub" filter="food"/> <Article title="1.2" info="main" filter="food"/> </Document> <Document chapter="2" title="title 2" href="file2.xml" filter="drink"> <Article title="2.1" info="sub" filter="drink"/> <Article title="2.2" info="main" filter="food"/> </Document> <Document chapter="3" title="title 3" href="file2.xml" filter=""> <Article title="3.1" info="sub" filter="drink"/> <Article title="3.2" info="child" filter=""/> </Document> </Documents> From: David Carlisle <davidc@xxxxxxxxx> _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today - it's FREE! hthttp://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
|

Cart



