Re: dl/dt/dd matching

Subject: Re: dl/dt/dd matching
From: David Rosenborg <David.Rosenborg@xxxxxxxxxxx>
Date: Wed, 13 Jan 1999 14:11:30 +0100
Another suggestion:

Allow the select patterns 'previous (MatchExpr)' and 'next (MatchExpr)'.

<xsl:template match="dl">
  <table>
    <xsl:for-each select="dt">
      <tr>
        <xsl:apply-templates/>
        <xsl:apply-templates select="next (dd)"/>
      </tr>
    </xsl:for-each>
  </table>
<xsl:template>

<xsl:template match="dt|dd">
  <td><xsl:apply-templates/></td>
</xsl:template>

The previous and next patterns would select the nearest sibling
of the current node that matches the match pattern.

Also if 'previous ()' and 'next ()' could be used
for matching an element of the same type as the current node,
the first-of-type, first-of-any etc boolean expressions would not be
needed.

Maybe I've overlooked some deficiencies with this solution
but to me it looks simpler and more intuitive than a 'group'
solution. However, it is less declarative and more explicit
which might not be desired.

</David>

___________________________________________________________________
David.Rosenborg@xxxxxxxxxxx                        OM Technology AB


James Clark wrote:
> 
> 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?
> 
> James
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread