|
Subject: Re: [xsl] self axis vs . From: "Mukul Gandhi" <gandhi.mukul@xxxxxxxxx> Date: Sat, 7 Jun 2008 19:14:35 +0530 |
On Sat, Jun 7, 2008 at 3:36 AM, Florent Georges <lists@xxxxxxxxxxxx> wrote:
> <xsl:apply-template select="*"/>
>
> <xsl:template match="elem">
> <!-- do something -->
> </xsl:template>
I agree that your suggestion above is more clean.
Following are some use cases where I find self:: axis to be useful.
<xsl:template match="*[not(self::elem)]">
<!-- do something -->
</xsl:template>
<xsl:template match="*">
<xsl:if test="not(self::elem)">
<!-- do something -->
</xsl:if>
</xsl:template>
Of course there could be alternates ways of writing the logic, like
using the name() or local-name() function.
We could start of a discussion of for-each vs. apply-templates :) You
suggested xsl:apply-template over the for-each example I posted. There
are times when I *don't want to* define a template. I just want to do
for-each at the place where I am.
--
Regards,
Mukul Gandhi
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] self axis vs ., Florent Georges | Thread | Re: [xsl] self axis vs ., Vyacheslav Sedov |
| Re: [xsl] ESCAPE SINGLE QUOTES FOR , Martin Honnen | Date | Re: [xsl] self axis vs ., Vyacheslav Sedov |
| Month |