Re: [xsl] Matching all elements in a namespace

Subject: Re: [xsl] Matching all elements in a namespace
From: Kjetil Kjernsmo <kjetil@xxxxxxxxxxxx>
Date: Sat, 7 Feb 2004 23:39:45 +0100
On Saturday 07 February 2004 22:42, Michael Kay wrote:
> > So, the obvious thing felt like something like...:
> > <xsl:template match="namespace-uri() =
> > ''">
> > 	      <xsl:copy-of select="."/>
> > </xsl:template>
> >
> > ...and I've tried numerous variations over this theme over the past
> > couple of weeks, but it doesn't "work".
> When the obvious thing doesn't work, the time has come to read the
> spec.

Uhm, well, yeah, I know. Sort of did that... And I often enjoy reading 
specs. And I have this big book. But you know, when you're confused 
from the outset, details often slip by...

> You can match all elements in a namespace by writing
> <xsl:template
> match="*[namespace-uri()='']"

Aha, pling, that makes sense!

> or by
> <xsl:template match="xhtml:*"
> xmlns:xhtml="";>

Right. OK, when you say that, some points that were unclear from the faq  
(matching namespaces in source document), makes a whole lot more sense 
in light of this. 

> Whether <xsl:copy-of> is really what you want to do inside the
> template rather depends on details of the requirement, which you
> haven't explained very fully.

Probably because the requirements are not very clear to me at this 
point... :-) I'm having a steep learning curve... I didn't choose XSLT 
because I knew how to write it, but because it looked like an 
interesting approach. So your help is highly appreciated. I'll try to 
ask more intelligently the next time! :-)

Thanks a lot, I'll try these suggestions out tomorrow!


Kjetil Kjernsmo
Astrophysicist/IT Consultant/Skeptic/Ski-orienteer/Orienteer/Mountaineer
kjetil@xxxxxxxxxxxx  webmaster@xxxxxxxxxx  editor@xxxxxxxxxxxxxxxxxxxxxx
Homepage:        OpenPGP KeyID: 6A6A0BBC

 XSL-List info and archive:

Current Thread