Re: [xsl] Applying templates by selecting it

Subject: Re: [xsl] Applying templates by selecting it
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 20 Jul 2005 11:34:38 -0400
Dear Sylvain,

At 11:16 AM 7/20/2005, you wrote:
Yeah cheers. In fact in my first sample version, I was using 'node' instead of
'a' for naming my template. But then I did realise that it would be more
confusing due to the very function you mentioned (node()).

Ah, okay. (FWIW: node() is not a function, it's a node test. :-)


So in my email I changed the XML document from 'node' to 'a' but forgot to
change the template as well.

Yet since the default builtin template for elements is


<xsl:template match="*">
  <xsl:apply-templates/>
</xsl:template>

and that for text nodes is (notice that *node test* in the pattern, "text()"):

<xsl:template match="text()">
  <xsl:value-of select="."/>
</xsl:template>

it turns out that, at least in your toy example, no extra template is needed for that "a" element (since it will descend to its text node child by default, which by default gets written out).

Anyway, lots of bandwith usage for nothing... my fault :)

Oh I don't know -- sometimes these little conversations are useful, and you never know to whom. There are plenty of people lurking on the list especially in order to scoop up nuggets of insight found in such discussions.


Cheers again,
Wendell



======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

Current Thread