Re: [xsl] default template ?

Subject: Re: [xsl] default template ?
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 27 Sep 2010 11:52:53 -0400
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