[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Matching text nodes


Subject: Re: [xsl] Matching text nodes
From: "Steve Muench" <Steve.Muench@xxxxxxxxxx>
Date: Tue, 26 Dec 2000 09:36:19 -0800

|   <xsl:template match="text()" >
| 
| nothing is matched, but when i do this in this way 
| ( AFAIK this does the same )
| 
|   <xsl:template match="*/text()" >
| 
| evrything is ok, i can understand why second works , but why first not ?
| 
| FYI i'm using Oracle 2.0.9 parser in W2k..


Hard to say without seeing the rest of your stylesheet's
templates, but I'm going to guess that you have the
following situation going on...

You probably have:

  <xsl:template match="text()">

then later in the stylesheet:

  <xsl:template match="node()|@*">

with an identity transformation template.

Since match="text()" has the same priority as
match="node()", and since both text() and node()
match a text node, the match="node()" will fire
instead of the match="text()" since it occurs
later in document order in the stylesheet. By your
changing the match pattern to match="*/text()"
this becomes more specific than match="node()" so
this causes your match="*/text()" rule to "get noticed"
by the XSLT engine where it previously was being ignored.

The solution is to change your template to have
an explicit priority like this:

   <xsl:template match="text()" priority="2">

which makes it take priority over the match="node()"
template.

______________________________________________________________
Steve Muench, Lead XML Evangelist & Consulting Product Manager
BC4J & XSQL Servlet Development Teams, Oracle Rep to XSL WG
Author "Building Oracle XML Applications", O'Reilly
http://www.oreilly.com/catalog/orxmlapp/





 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords