it`s for XSLT 1.0 in XSLT 2.0 i prefer use "* except elem"
axis 'self' better work for node type testing for example XPath
"//*[following-sibling::node()[1][self::comment()]]" select all nodes
that immediately followed by comment but maybe it is not optimal way
too
On Sat, Jun 7, 2008 at 5:44 PM, Mukul Gandhi
<gandhi(_dot_)mukul(_at_)gmail(_dot_)com> wrote:
On Sat, Jun 7, 2008 at 3:36 AM, Florent Georges
<lists(_at_)fgeorges(_dot_)org> 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
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--