O
O
Oscar Handsome2017-10-26 18:35:07
XSL & XSLT
Oscar Handsome, 2017-10-26 18:35:07

How to display parent in template, xslt, umi?

Hi all!
I'm struggling with a task that seems to be trivial for more than a day. If anyone can tell me what is wrong?
There is a template through which I display a list of directories on the main page using a macro:
code:

<!-- Пример для списков getCategoryList - версия 2 -->
<xsl:template match="udata[@method = 'getCategoryList']" mode="test">
    <ul>
      <xsl:apply-templates select="//item" mode="test" />
    </ul>
  </xsl:template>
        
  <xsl:template match="udata[@method = 'getCategoryList']//item" mode="test">
    <li>
        <a href="{@link}" >
          <xsl:value-of select="." />
        </a>
      <xsl:apply-templates select="document(concat('udata://catalog/getCategoryList/void/', @id, '//1/'))" mode="test1"/>
    </li>
  </xsl:template>
    
        <xsl:template match="udata[@method = 'getCategoryList']" mode="test1">
    <h3 style="color:red"><xsl:value-of select="ancestor::*"/></h3> *
                <ul>
      <xsl:apply-templates select="items" mode="test1"/>
    </ul>
  </xsl:template>
        
        <xsl:template match="udata[@method = 'getCategoryList']//item" mode="test1">
    <li>
                    <a href="{@link}" >
      <xsl:value-of select="." />
                    </a>
    </li>
  </xsl:template>

Macro on main
<xsl:apply-templates select="document('udata://catalog/getCategoryList/1/(shop)/23//0/?extProps=header_pic,header,title,result')/udata"/>

I'm trying from the first level to take the li item and tile it in the ul's child list in front of all the li's using <xsl:value-of select="ancestor::*"/>
59f1febd16754174779884.png
But I'm doing something wrong.
I tried to go along the axes, according to the manual
, using parent and ancestor, but I'm doing something wrong.
for menu lists, it works for me
<xsl:copy-of select="ancestor::item" />
But sub-items are also displayed.
59f1ffc3d4ce0547706204.png
I don't understand what's the catch. Maybe because of mods? that the point-blank sublevel does not see the parent?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Melikhov, 2017-11-01
@VeroLom

I don't quite understand the problem, can you be more specific?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question