Re: [xsl] Managing debug logging in complex transforms: what do people do?

Subject: Re: [xsl] Managing debug logging in complex transforms: what do people do?
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Mon, 24 Mar 2014 20:54:35 +0000
On 24 March 2014 20:46, Eliot Kimber <ekimber@xxxxxxxxxxxx> wrote:
> I'll have to think about the details of <xsl:message> more before I can
> answer the XSLT 3 requirements question.
>
> But something I'd really like is a way to get the current mode name so I
> can put it in the message, without having to pass it as a second debugging
> tunnel parameter.
>
> E.g.:
>
> <xsl:template mode="#all" match="*">
>   <xsl:message> + [DEBUG] {$modeName}: Unhandled element <xsl:value-of
> select="concat(name(..), '/', name(.))"/></xsl:message>
> </xsl:template>
>
> Where here "{$modeName}" is a placeholder for some way to reflect the
> current mode.

I can't think of a "proper" way... I'm not sure there is one.  You
could just do:

<xsl:apply-templates select="$find-mode" mode="#current"/>

where $find-mode is an element such as

<mine:find-mode/>

and then have a template for each mode in your xslt:

<xsl:template match="mine:find-mode" mode="aaa">aaa</xsl:template>

<xsl:template match="mine:find-mode" mode="bbb">bbb</xsl:template>

etc

Not great, but it would do the job.

-- 
Andrew Welch
http://andrewjwelch.com

Current Thread