I am creating an XSLT that transforms a table.

I would like to know the number of the element with an arbitrary attribute value among the children of my parent's older brother (preceding-sibling).
For example, in XSLT for the following XML, when matchingof "E", the attribute value of morerows is 1 (@ morerows = "1") in the child of the previous. I want to know what numberentry>is in that.

          <tgroup cols = "3">
                      <entry more rows = "1">AD</entry>

I set the following variables in the relevant part of XSLT, but I can't get the value I want due to an error.

<xsl: template match = "entry">
<!-The first<row>skips the following processing->
<xsl: variable name = "morerows_entry_num"
  select = "position (parent :: node (preceding-sibling :: node ()/entry [@ morerows = 1]))" />
<!-Hereafter, the process is branched based on the acquired information->

Would you please point out any inadequacies in the description?
If i can't combine XPath in the first place, is there a way to get the above information?

  • Answer # 1

    I didn't understand the meaning of "overlapping reference points" and "combining XPath".


    Among the children of the previous, thewhose attribute value of morerows is 1 (@ morerows = "1") is the numberin that.

    Translated verbatim, it looks like this:

    <xsl: variable as = "xs: integer?" name = "morerows_entry_num" select = "
        (: In the previous row :)
        parent :: row/preceding-sibling :: row [1]
        (: Among children, entry with @ morerows = 1 is :)
       /entry [@morerows = 1]
        (: What number entry in that row :)
       /count (preceding-sibling :: entry |.) "/>