xsl-list
[Top] [All Lists]

Re: Matching all elements in a namespace

2004-02-07 15:39:45
On Saturday 07 February 2004 22:42, Michael Kay wrote:
So, the obvious thing felt like something like...:
<xsl:template match="namespace-uri() =
'http://www.w3.org/TR/xhtml1/strict'">
          <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()='http://www.w3.org/TR/xhtml1/strict']"

Aha, pling, that makes sense!

or by

<xsl:template match="xhtml:*"
xmlns:xhtml="http://www.w3.org/TR/xhtml1/strict";>

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!

Best,

Kjetil
-- 
Kjetil Kjernsmo
Astrophysicist/IT Consultant/Skeptic/Ski-orienteer/Orienteer/Mountaineer
kjetil(_at_)kjernsmo(_dot_)net  webmaster(_at_)skepsis(_dot_)no  
editor(_at_)learn-orienteering(_dot_)org
Homepage: http://www.kjetil.kjernsmo.net/        OpenPGP KeyID: 6A6A0BBC


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



<Prev in Thread] Current Thread [Next in Thread>