Re: [xsl] Template priority problem

Subject: Re: [xsl] Template priority problem
From: david_n_bertoni@xxxxxxxxxx
Date: Tue, 6 Sep 2005 12:36:48 -0700
> > When people come to this list and say that a template
> > isn't matching when they expect it to, the most common
> > reason is that the elements are in a namespace (typically
> > a default namespace). You haven't shown us the source
> > document, so that's just a guess.

> Yes of course you are right. Damn Default namespace. Whats
> the best approach to solve my problem when all elements in
> the input XML are in a non-blank default namespace? I am
> thinking this may screw up the identity transform template.

No, it doesn't affect the canonical identity transformation.  However, it 
does affect the specialized templates you add to modify the identity 

<?xml version="1.0" encoding="UTF-8"?>


<xsl:template match="@* | node()">
    <xsl:apply-templates select="@* | node()"/>

<xsl:template match="foo:field">
  <!-- Here's where we should do something special... -->
    <xsl:apply-templates select="@* | node()"/>


Some other comments:

1. "@* | node()" is a less verbose version of "* | comment()
| text() | processing-instruction() | @*"

2. The priority attribute you are using are not necessary.  In most cases, 
the default priorities for match patterns are sufficient.

3. Default namespaces may also affect the XPath expressions you use in 
your xsl:variable definitions.



Current Thread