[xsl] Re: Re: Method for delimiting template results

Subject: [xsl] Re: Re: Method for delimiting template results
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Wed, 5 Mar 2003 23:38:01 +0100
"Ted Stresen-Reuter" <tedmasterweb@xxxxxxx> wrote in message
news:AB70C6E4-4F56-11D7-92A9-00039315D01C@xxxxxxxxxx
> Thanks for the reply. Upon reflection, I realized that I had the
> solution and then saw your email. However, I also realized that this
> particular solution won't work if my checkbox elements are inside of a
> TABLE element (and they are) because the context for the position() and
> last() is the enclosing TD element.
>
> Any suggestions on how I can "globalize" the context short of doing two
> passes on the xml source (to reduce it to, say, just the FORM element)?

Let's say you have the following source.xml:

<table>
  <tr>
    <td>
      <input type="checkbox" name="first"/>
    </td>
    <td>
      <input type="checkbox" name="second"/>
    </td>
    <td>
      <input type="checkbox" name="third"/>
    </td>
  </tr>
</table>

Then you can use the same transformation, with only the following change:

Replace:

       <xsl:if test="not(position() = last())">,</xsl:if>

with:

       <xsl:if
test="../following-sibling::td[input[@type='checkbox']]">,</xsl:if>


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL







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


Current Thread