A: 
<xsl:variable name="pathVariable">
  <xsl:for-each select="ancestor-or-self::*">
    <xsl:if test="name() != 'root'">
      <xsl:element name="dummy"><xsl:value-of select="name()"/></xsl:element>
      <xsl:if test="not(position()=last())">
        <xsl:element name="dummy">/</xsl:element>
      </xsl:if>
    </xsl:if>
  </xsl:for-each>
</xsl:variable>

<!-- a 100 places throughout the document -->
<xsl:attribute name="path">
  <xsl:value-of select="$pathVariable/text()"/>
</xsl:attribute>
xixxix
+1  A: 

I think you could use a call to a named template to do what this

<xsl:template name="ancestors">
   <xsl:for-each select="ancestor-or-self::*">
      <xsl:if test="name() != 'root'">
         <xsl:value-of select="name()" />
         <xsl:if test="not(position()=last())">
            <xsl:text>/</xsl:text>
         </xsl:if>
      </xsl:if>
   </xsl:for-each>
</xsl:template>

You can then simply call this from within the parameter.

<xsl:attribute name="path">
   <xsl:call-template name="ancestors" />
</xsl:attribute>

When you call the named template, the context remains as the current node, so it should work as desired.

Tim C
great, that's it! thanks so much.
viatropos
A: 

Thanks alot!! It helped me alot!!

Raghu