xsl-list
[Top] [All Lists]

[xsl] XPath to find first cell in first row of table

2016-09-21 20:14:58
I have an XML table like below from which I am constructing a roughly matching XSL-FO table, and I need to insert something extra only in the first cell of the first row, as indicated:

   <table>
     <title>My title</title>
     <tgroup cols="3">
       <colspec colname="C1" />
       <colspec colname="C2" />
       <colspec colname="C3" />
       <thead>
         <row>
           <entry> text </entry>
           <entry> text </entry>
           <entry> text </entry>
         </row>
       </thead>
       <tbody>
         <row>
           <entry> <!-- insert something extra here only --> text </entry>
           <entry> text </entry>
           <entry> text </entry>
         </row>
         <row>
           <entry> text </entry>
           <entry> text </entry>
           <entry> text </entry>
         </row>
       </tbody>
     </tgroup>
   </table>

There are templates matching each element: table, tbody, row, entry, etc. In the <entry> template, how might I check if the current entry is the first one in the first row? Or is there a better way?

  <xsl:template match="entry">
<xsl:if test="MAGICAL XPATH that tells if it's the first cell in the first row">
      <fo:block> insert special things </fo:block>
    </xsl:if>
    <fo:block xsl:use-attribute-sets="entry">
      ...
    </fo:block>
  </xsl:template>

Thanks,
Mark
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--

<Prev in Thread] Current Thread [Next in Thread>