Hi,
You can define a priority for every template.
Like this:
<xsl:template match="P101|P102" priority="10">
<entry align="center"><xsl:value-of
select="format-number(number(text()),'.##')"/></entry>
</xsl:template>
regards
. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
XSLT Developer
LexisNexis
Marxergasse 25, 1030 Wien
mailto:patrick(_dot_)szabo(_at_)lexisnexis(_dot_)at
Tel.: +43 (1) 534 52 - 1573
Fax: +43 (1) 534 52 - 146
-----Ursprüngliche Nachricht-----
Von: Fabien Tillier [mailto:f(_dot_)tillier(_at_)cerep(_dot_)fr]
Gesendet: Montag, 28. März 2011 16:40
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Betreff: [xsl] template matching priority...
Hi List.
I have an XML like
<xml>
<results>
<row>
<N100>test1</N100>
<P101>95.1268</P101>
<P102>0.12687</P102>
<N50>0.56</N50>
</row>
<row>
<N100>test2</N100>
<P101>96.1268</P101>
<P102>1.12687</P102>
<N50>0.57</N50>
</row>
...
</results>
I would like, during the parsing, that some of the nodes in row to be
treated by specific templates
Like
<xsl:template match="P101|P102">
<entry align="center"><xsl:value-of
select="format-number(number(text()),'.##')"/></entry>
</xsl:template>
But I can have lots of different cases, and some won't need something
really specific (except the surrounding entry nodes).
So, I defined a "fallback" template like below
<xsl:template match="*[matches(local-name(),'[N,P]{1}[0-9]+')]">
<entry><xsl:value-of select="text()"/></entry>
</xsl:template>
My trouble now, is that the last one is called rather than the former
(more specific) one.
Is there a way I can define the template so that it is to be used with a
lesser priority than the others ?
Or any other method ?
Thanks a lot in advance,
Best regards,
Fabien.
--~------------------------------------------------------------------
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>
--~--