Subject: Re: [xsl] node() function From: "Wendell Piez wapiez@xxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 24 Jun 2014 13:51:38 -0000 |
Hi, Another explanation for the behavior is that this template: <xsl:template match="node()"> <xsl:apply-templates/> </xsl:template> will override the built-in template for text nodes: <xsl:template match="text()"> <xsl:value-of select="."/> </xsl:template> Of course it is that template that ordinarily accounts for why text contents of the source are copied to the result. But text nodes have no children, so when the context is a text node, the xsl:apply-templates instruction has no effect (since no templates are applied to any children). This is why the OP's stylesheet 1 creates no output -- because templates are applied all the way down, but none of them ever write anything to the result. The solution is not to use node() when you don't want to match (or select) text nodes ... use *, processing-instruction(), comment() instead. Or see to it that you have another template to override the match on 'node()': <xsl:template match="text()" priority='1'> <xsl:value-of select="."/> </xsl:template> Cheers, Wendell -- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] node() function, Abel Braaksma (Exsel | Thread | Re: [xsl] node() function, Dimitre Novatchev dn |
Re: [xsl] Getting epub: namespace i, Wendell Piez wapiez@ | Date | [xsl] XSL-FO question regarding con, Mario Madunic mario. |
Month |