Subject: AW: [xsl] template matching priority... From: "Szabo, Patrick \(LNG-VIE\)" <patrick.szabo@xxxxxxxxxxxxx> Date: Mon, 28 Mar 2011 16:42:03 +0200 |
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.szabo@xxxxxxxxxxxxx Tel.: +43 (1) 534 52 - 1573 Fax: +43 (1) 534 52 - 146 -----UrsprC<ngliche Nachricht----- Von: Fabien Tillier [mailto:f.tillier@xxxxxxxx] Gesendet: Montag, 28. MC$rz 2011 16:40 An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx 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.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] template matching priority..., Fabien Tillier | Thread | Re: [xsl] template matching priorit, Wendell Piez |
[xsl] template matching priority..., Fabien Tillier | Date | Re: [xsl] template matching priorit, Wendell Piez |
Month |