xsl-list
[Top] [All Lists]

Re: XSLT Grouping/Filtering issue with preceding/following axes

2005-08-06 00:47:07
Tempore 23:03:47, die 08/05/2005 AD, hinc in 
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com scripsit Jacquo Johnson 
<genxgeek(_at_)gmail(_dot_)com>:

         <!-- However, this does not work for the 30DAYPM as it is missing
the LT CodeId group -->
  <xsl:variable name="uh2" select="//Record[CodeId='30DAYPM']"/>
  <xsl:element name="Copy">
      <xsl:copy-of select="$uh2"/>
   </xsl:element>
   <xsl:element name="Filter">
      <xsl:copy-of
select="$uh2[not(AttributeName=preceding::*/AttributeName)]"/>
   </xsl:element>

indeed, there's an additional predicate missing:
<xsl:copy-of 
select="$uh2[not(AttributeName=preceding::*[CodeId='30DAYPM']/AttributeName)]"/>

btw, here you have a sample using the Muenchian technique:

<xsl:key name="recordByC" match="Record" use="CodeId"/>
<xsl:key name="recordByCA" match="Record" use="concat(CodeId,AttributeName)"/>

<xsl:template match="/">
        <xsl:variable name="uh2" select="key('recordByC','30DAYPM')"/>
        <xsl:element name="Copy">
                <xsl:copy-of select="$uh2"/>
        </xsl:element>
        <xsl:element name="Filter">
                <xsl:copy-of 
select="$uh2[generate-id()=generate-id(key('recordByCA',concat('30DAYPM',AttributeName))[1])]"/>
        </xsl:element>
</xsl:template>

regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
«Φιλήκοον ειναι μαλλον η φιλόλαλον»  - Κλεόβουλος

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--