Re: dl/dt/dd matching

Subject: Re: dl/dt/dd matching
From: Francois Belanger <francois@xxxxxxxxxxx>
Date: Wed, 13 Jan 99 11:13:24 -0500
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


Current Thread