|
Subject: [xsl] How can one get the name of a template or function? From: "Houghton,Andrew" <houghtoa@xxxxxxxx> Date: Wed, 11 Feb 2009 11:20:33 -0500 |
I'm using Saxon as an XSL transform processor. So I don't mind whether the
answer is specific to Saxon or is general to all XSL transform processors.
What I would like to do is to get the name of the current template or function
that is currently executing. I realize that templates don't need to be named,
but in my case they will be named since I'm using xsl:call-template on them.
So for example I would like to do something like:
<xsl:template name="foo" as="item()*">
<xsl:variable name="my-name" as="xsd:string" select="get-name()" />
</xsl:template>
<xsl:function name="bar" as="item()*">
<xsl:variable name="my-name" as="xsd:string" select="get-name()" />
</xsl:function>
Where get-name() is some sort of function that will give me the name of the
template or function. I don't really care if its a function or a template
that I have to call to get this information. When looking over the list of
XPath function I don't see anything useful and I didn't see anything in
Saxon's extensions. So my question is can this be done somehow?
BTW, I realize that I could do:
<xsl:template name="foo" as="item()*">
<xsl:variable name="my-name" as="xsd:string" select="string('foo')" />
</xsl:template>
<xsl:function name="bar" as="item()*">
<xsl:variable name="my-name" as="xsd:string" select="string('bar')" />
</xsl:function>
but I would prefer not to do that since when the name attribute changes, I
need to keep the variable in sync too.
Thanks, Andy.
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| RE: [xsl] most efficient way to get, Michael Kay | Thread | Re: [xsl] How can one get the name , David Carlisle |
| RE: [xsl] most efficient way to get, Michael Kay | Date | Re: [xsl] most efficient way to get, Robert Koberg |
| Month |