RE: [xsl] default template ?

Subject: RE: [xsl] default template ?
From: "Fabien Tillier" <f.tillier@xxxxxxxx>
Date: Mon, 27 Sep 2010 17:56:43 +0200
Thank you Ken.
I think it is a very basic question....

Regards,
Fabien


-----Message d'origine-----
De : G. Ken Holman [mailto:gkholman@xxxxxxxxxxxxxxxxxxxx]
Envoyi : lundi 27 septembre 2010 17:53
@ : xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Objet : Re: [xsl] default template ?

At 2010-09-27 17:27 +0200, Fabien Tillier wrote:
>I was wondering how an XSL Stylesheet can be done to treat all nodes in
>an XML file if a template doesn't fit.
>I mean, if an xml is like
><Row>
>         <A>A value</A>
>         <B>B value</B>
>         <C>C value</C>
></Row>
>
>If I get one template for treating <A> nodes (match = "A"), and one for
><B> nodes, I would like to have some kind of fall back template for the
>C nodes which don't have a specific one.
>Is this possible ?

Certainly ... the XPath for an element of any name is "*".

The XPath for a node of any time is "node()".

So, for what you want:

   <xsl:template match="*">
     ... any element not matched elsewhere ...
   </xsl:template>

I hope this helps.

. . . . . . . . . . . . Ken





--
XSLT/XQuery training:   after http://XMLPrague.cz 2011-03-28/04-01
Vote for your XML training:   http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
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