Re: [xsl] Is the context node accessible from within a called template ?

Subject: Re: [xsl] Is the context node accessible from within a called template ?
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 1 Aug 2017 15:43:03 -0000
On 01.08.2017 17:31, Kerry, Richard richard.kerry@xxxxxxxx wrote:

I have a pattern-matching template which calls (ie with call-template) a named template. Although there is of course a context node that is valid throughout the pattern-matched template it isn't clear whether it remains accessible from within the called template. Can someone please tell me whether it is or not? I'm sure when I was working on something a while ago I concluded that it is accessible, but now it isn't happening. I'm not sure whether I've got the addressing wrong or whether I've misremembered and it is not in fact possible.

I have XML data that contains elements like this :
<symbol name="sysORIndex">
<table-object entry-name="sysOREntry" sequence-name="SysOREntry" table-name="sysORTable"/>
<object-type max-access="not-accessible" status="current">

Sometimes the table-object is not present.

My main XSLT template starts:
<xsl:template match="symbol/object-type" mode="slotmap">

Within that I can use "../table-object" to access the table-object element.

That template calls another:
   <xsl:call-template name="insert">
<xsl:with-param name= ... />

Within "insert" should I be able to use "../table-object" to access the table-object element?

Actually there is another level, as "insert" calls another:
   <xsl:call-template name="integer-template-param" >
<xsl:with-param ... />

Does that make a difference ? I'd have thought that either the original context node would be accessible from all levels of called templates, or none.

An xsl:call-template does not change the context node, of course using an xsl:for-each for instance inside the called template then would. You haven't provided a minimal but complete sample of XSLT, XML, output you want and output or error you get to allow us to tell what fails and why.

Current Thread