XSLT & xmlns

R

rufio

Hi all
I have a <xsl:template> that matches an <element>, but i found that this
template doesn't match <element xmlns="URL">.

Why and how to match it?


Regards, Rufio
 
M

Mike Brown

rufio said:
Hi all
I have a <xsl:template> that matches an <element>, but i found that this
template doesn't match <element xmlns="URL">.

Why and how to match it?

Why:

The matching is done based on the "expanded name" of the element. The
expanded name is two pieces of information: the "local name" (whatever comes
after the prefix, if there is one, otherwise, just the name), and the
"namespace", which is the URI. In other words, element nodes named
'element'-in-no-namespace are not the same as element nodes named
'element'-in-the-'URL'-namespace.

How:

In your stylesheet, bind the namespace 'URL' to a prefix, and match
thatprefix:element.
 
R

rufio

In your stylesheet, bind the namespace 'URL' to a prefix, and match
thatprefix:element.

Thanks, it works

Is there a way to omit theprefix in each step, like in
prefix:god/prefix:damn/prefix:prefixes ?


Regards, Rufio
 
M

Mike Brown

Is there a way to omit theprefix in each step, like in
prefix:god/prefix:damn/prefix:prefixes ?

XSLT 2.0 / XPath 2.0 will have such a feature.
XSLT 1.0 / XPath 1.0 does not. Sorry :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top