[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: dl/dt/dd matching
James Clark wrote on 12/01/99 23h40: >Francois Belanger wrote: > >> How about: >> >> <xsl:template match="dl"> >> <table> >> <xsl:for-each select="group(dt)"> >> <tr><xsl:apply-templates/></tr> >> </xsl:for-each> >> </table> >> </xsl:template> >> >> <xsl:template match="dt|dd"> >> <td> >> <xsl:apply-templates/> >> </td> >> </xsl:template> >> >> This way one can see that the tr will enclose the td. > >I agree this looks more intuitive, but what exactly are the semantics >that you have in mind? As you mentionned earlier: >One solution is to allow nodes to be grouped together: > >[[A1, B1], [A2, B2], [A3, B3]] > >and then specify an operation f on the results of groups, thus getting > >f(r(A1) + r(B1)) + f(r(A2) + r(B2)) + f(r(A3) + r(B3)) but instead of specifying an operation, I would consider [[A1, B1], [A2, B2], [A3, B3]] as the three nodes result of group() match and then apply the template to those three nodes as usual. Since the group match acts more like a slice (slice it as each element name), we should maybe call it slice(ElementName). <xsl:template match="slice(dt)"> <tr><xsl:apply-templates/></tr> </xsl:template> I can see here that this is modifying the input tree by creating new parent nodes to act as a container of each slice. From previous postings on this list, this seems to cause problems, is it in this case? Francois Belanger Sitepak, Bringing Internet Business into Focus http://www.sitepak.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|