xsl-list
[Top] [All Lists]

Re: [xsl] namespace problem

2014-09-15 03:27:04
On 09/11/14 14:50, Wendell Piez wapiez(_at_)wendellpiez(_dot_)com wrote:
As to your question (how to match in the xhtml namespace only), one
helpful insight could be that the prefixes used in the XSLT do *not*
have to be the same as the prefixes used in the source documents
(which, indeed, may not always be consistent with one another either).
Or anywhere else. Only the namespaces must correspond; the prefixes
are only a way to get to the namespaces.

So neither of these would match 'char' in no namespace; one matches
'char' in the xhtml namespace ... and so does the other:

<xsl:template match="char"
  xpath-default-namespace="http://www.w3.org/1999/xhtml";>
    ... matches 'char' in the xhtml namespace

<xsl:template match="xh:char"
   xmlns:xh="http://www.w3.org/1999/xhtml";>
   ... matches 'char' in ... the xhtml namespace


Hi Wendell and Wolfgang,

got it. Thanks for your explanation. The latter was exactly what I tried, but what did not work for me. What made me ask the question. I must have forgotten to specify the mode attribute so that the template did not fire.
Very glad to be on the 'understanding' track again.

Indeed, a helpful processor, when it sees both of these together in
the same XSLT, will warn you that you have a template clash. (Try it.
:-)
I use saxon, and indeed, it gives a warning.

Thank you both for helping me!

Ruud
--~----------------------------------------------------------------
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>