xsl-list
[Top] [All Lists]

[xsl] template matching priority...

2011-03-28 09:40:30
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>