Matching all elements in a namespace
Hello World! I just subscribed, as I heard this is _the_ list for XSLT "user" questions? :-) My question feels like a common requirement, and therefore a FAQ, but I really can't find the answer... To take an example, my XML contains a few XHTML elements, and I figured I'll just declare them in the XHTML namespace, and then copy-of all elements in this namespace to the result document, with the namespace declaration and all... (later, I want to do similar things with other namespaces). 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". I'm developing on the top of AxKit, so I'm using XML::LibXSLT and Apache::AxKit::Language::LibXSLT to do the work. I could use Sablotron also, however. Also complicating matters, is that this is just a part of a pipeline, starting with AxKit's XSP page. So, I am to a certain extent at the mercy of what AxKit will give me, which again implies that whatever I do should work if I have a xmlns attribute on the root element, and shorthand prefixes on the rest, or a xmlns attribute on whatever elements there are in that namespace, or, well, you get the idea... :-) I figured it should be most robust to match on the namespace-uri rather than a prefix shorthand, since the latter can be chosen rather arbitrarily by an author, whereas the namespace-uri has a more clearly defined meaning. Is this reasoning sound? BTW, if anybody's interested (ok, it is a shameless plug), the application I'm developing I've called TABOO, I'm introducing a bit more abstraction and OO design, and the first thing I'm building is a news-site. I've released something allready: http://www.kjetil.kjernsmo.net/software/TABOO/ Cheers, Kjetil -- Kjetil Kjernsmo Astrophysicist/IT Consultant/Skeptic/Ski-orienteer/Orienteer/Mountaineer kjetil@xxxxxxxxxxxx webmaster@xxxxxxxxxx editor@xxxxxxxxxxxxxxxxxxxxxx Homepage: http://www.kjetil.kjernsmo.net/ OpenPGP KeyID: 6A6A0BBC XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format