Subject: Re: [xsl] Applying Attributes with Grouping Method From: David Carlisle <davidc@xxxxxxxxx> Date: Wed, 21 Mar 2007 12:48:35 GMT |
> I'm tired of banging my head against the wall. Keep doing it, you get used to it eventually! > Now, I can get the name attributes grouped using the Muenchian Method > in you are using saxon8 so XSLT2 so you don't need Muenchian grouping, once I'd made your input example well formed, it's just a call to xsl:for-each-group: <connection> <conn name="P21" part="W1123"> <property name="s_des" val="Part_A"/> </conn> <conn name="P22" part="W1123"> <property name="s_des" val="Part_A"/> </conn> <conn name="P23" part="W1123"> <property name="s_des" val="Part_A"/> </conn> <conn name="J31" part="W1144"> <property name="s_des" val="Part_B"/> </conn> <conn name="J32" part="W1145"> <property name="s_des" val="Part_C"/> </conn> </connection> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes"/> <xsl:template match="connection"> <report> <xsl:for-each-group select="conn" group-by="property[@name='s_des']/@val"> <item part="{@part}" uantity="{count(current-group())}" val="{current-grouping-key()}" name="{current-group()/@name}"/> </xsl:for-each-group> </report> </xsl:template> </xsl:stylesheet> $ saxon8 connection.xml connection.xsl <?xml version="1.0" encoding="UTF-8"?> <report> <item part="W1123" uantity="3" val="Part_A" name="P21 P22 P23"/> <item part="W1144" uantity="1" val="Part_B" name="J31"/> <item part="W1145" uantity="1" val="Part_C" name="J32"/> </report> David
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Applying Attributes with Grou, Fanghanel, Karl | Thread | RE: [xsl] Applying Attributes with , Fanghanel, Karl |
[xsl] Applying Attributes with Grou, Fanghanel, Karl | Date | Re: [xsl] Applying Attributes with , Abel Braaksma |
Month |