Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I found the kipelovets' and GuruM's answers to be useful and worked out this solution that combines their advice.:</p> <p>.ctags file:</p> <pre><code>--langdef=xslt --langmap=xslt:.xsl --regex-xslt=/&lt;xsl:template[^&gt;]+name=\"([-a-zA-Z0-9_:]+)\"( +mode="([^"]+)")?/\1 \2/n,namedtemplate/i --regex-xslt=/&lt;xsl:template[^&gt;]+match=\"([^"]+)\"( +mode="([^"]+)")?/\1 \2/m,matchedtemplate/i --regex-xslt=/&lt;xsl:apply-templates +select="([^"]{2,})"( +mode="([^"]+)")?/\1 \2/a,applytemplate/i --regex-xslt=/&lt;xsl:call-template +select="([^"]+)"( +mode="([^"]+)")?/\1 \2/c,calltemplate/i --regex-xslt=/&lt;xsl:variable[^&gt;]+name=\"([-a-zA-Z0-9_]+)\"/\1/v,variable/i --regex-xslt=/&lt;xsl:function[^&gt;]+name=\"([-a-zA-Z0-9_:]+)\"/\1/f,function/i --regex-xslt=/&lt;xsl:param[^&gt;]+name=\"([-a-zA-Z0-9_:]+)\"/\1/p,parameter/i </code></pre> <p>vim tagbar settings (which some people may find useful):</p> <pre><code>let g:tagbar_type_xslt = { \ 'ctagstype' : 'xslt', \ 'kinds' : [ \ 'n:templates (named)', \ 'm:templates (matched)', \ 'a:applied templates', \ 'c:called templates', \ 'f:functions', \ 'p:parameters', \ 'v:variables' \ ] \ } </code></pre> <p>It's better, but some issues I am still having include:</p> <ul> <li>grouping templates by their modes</li> <li>white space such as new lines in between attributes for a template/variable etc...</li> <li>scoping variables and parameters and apply templates and call templates <ul> <li>So if you have multiple variables with the same name but in different templates, the scope of which template they are in is not be captured.</li> </ul></li> <li>commented templates, functions, variables and parameters</li> </ul> <p>A better approach to try in future:</p> <ul> <li>The regex's for parsing the information from the xslt get complex to do this properly</li> <li>The best solution may be to write a custom xslt tag generator using xslt itself.<br> <ul> <li>This is what <a href="https://github.com/mozilla/doctorjs" rel="nofollow">jsctags</a> does for javascript</li> <li>The format of the tag file looks straightforward... so I will try this next. <ul> <li>See <a href="http://ctags.sourceforge.net/ctags.html#TAG%20FILE%20FORMAT" rel="nofollow">Tag File Format</a></li> </ul></li> </ul></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload