[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Obtaining the name of a template while executing t

Subject: Re: Obtaining the name of a template while executing the template
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 20 May 2009 09:58:21 -0400
Re:  Obtaining the name of a template while executing t
At 2009-05-20 09:48 -0400, mlcook@xxxxxxxxxx wrote:
I can't find the answer to my question in the references I have at hand,
or am overlooking the obvious.

I'd like to get the name of a template while executing that template,
and using the name in an error message.

That information is not available in standard XSLT ... look to any vendor extensions that may offer this.

I think I want something like:

<xsl:message>Error in template <xsl:something here to get the template's
name/>, bad value for <xsl:value-of select="$myvar" /></xsl:message>

Suggestions or alternatives?

Just hardwire the name ... you are already in the template when you write the message.

If you move the message to a standalone template, then from the template you are in just pass the name as a string value to the standalone template. Given that the names of templates don't change during processing, the value you are looking for is statically known and need not be made available dynamically for execution.

I hope this helps.

. . . . . . . . . . Ken

XSLT/XSL-FO/XQuery hands-on training - Los Angeles, USA 2009-06-08
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.