Subject: [xsl] template matching priority... From: "Fabien Tillier" <f.tillier@xxxxxxxx> Date: Mon, 28 Mar 2011 16:40:07 +0200 |
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 -> |
---|---|---|
Re: [xsl] [ANN] Saxon-CE - XSLT 2.0, Wendell Piez | Thread | AW: [xsl] template matching priorit, Szabo, Patrick \(LNG |
[xsl] [ANN] Saxon-CE - XSLT 2.0 on , Michael Kay | Date | AW: [xsl] template matching priorit, Szabo, Patrick \(LNG |
Month |