xsl-list
[Top] [All Lists]

Re: [xsl] WARNING org.xml.sax.SAXParseException: The child axis starting at a text node will never select anything

2014-05-14 02:13:52

On 13 May 2014, at 20:15, Kulas, Jack jkulas(_at_)lsijax(_dot_)com 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:

I was getting the following warning when I’d run a transformation within 
Arbortext Editor 6.1-F000, which uses the Saxon 9.1.0.5 XSLT transformation 
engine:
 
WARNING org.xml.sax.SAXParseException: The child axis starting at a text node 
will never select anything
 
When I replaced this template
 
    <xsl:template match="text()" mode="func">
       <xsl:value-of select="."/>
        <xsl:apply-templates mode="func"/>
    </xsl:template>

The apply-templates is a no-op; it processes the children of the text node, and 
there can never be any. If you remove the apply-templates, you get

 <xsl:template match="text()" mode="func">
       <xsl:value-of select="."/>
    </xsl:template>

Which is the default template for text nodes, so it does no harm to delete the 
whole thing,

 
with this one
 
    <xsl:template match="*" mode="func">
        <xsl:apply-templates mode="func"/>
    </xsl:template>
 

This template rule does nothing useful because it's the default template for 
element nodes.

So you've deleted one redundant template rule and added another redundant 
template rule, and the net effect, unsurprisingly, is that your code still 
works.

Michael Kay
Saxonica

--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>