Subject: Re: [xsl] a namespace problem From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Mon, 8 Apr 2002 17:45:33 +0100 |
Hi Bryan, > no argument there if I'm the xml designer, but in this case I was of > course the xml consumer, also there is one case in which it struck > as being useful to be able to switch prefixes, that being I have an > xslt that writes out an? xslt, so an xsl with the xsl prefix writes > out an xsl with the tempsl prefix, or vice-versa. However at one > point we hired a new xslt guy and, despite his having done this for > a year and a half and being a datalog, I guess that's going for a > masters in computer science, he didn't really know that there was > such a thing as namespaces or that you could write xslt with xslt > and so on and so forth(it was pretty trying) anyhow as I was > fiddling around writing my prefix-switcher I thought about how much > easier it would have been for him if he could have used it to switch > the before and afters to figure out what was going on. Yes, namespaces are a surprisingly neglected part of most people's understanding of XML, but something where it's fairly easy to muddle through. It's only when you bang your head against the problem you encountered -- the fact that XPath doesn't use the default namespace when resolving element names -- that you start having to actually understand them. With the changes in XPath/XSLT 2.0, there won't even be that impetus. XSLT generation is another test. It takes a while to get a handle on xsl:namespace-alias and what it's actually doing. This isn't helped by the fact that some processors use the result prefix and some the stylesheet prefix for the XSLT elements generated in the output. > I solved my rss: problem with your suggestion of course, but it > still does seem like one of the most counter-intuitive things about > xml I can think of. Funny enough I came across Joe English's > complaints about namespaces on xml-dev > http://lists.xml.org/archives/xml-dev/200204/msg00170.html which > reminded me of this. The question being that since my xslt used two > different prefix's for the rss namespace, did this make the xslt a > borderline document? Probably. I don't understand why you have got two different namespace prefixes associated with the same namespace in the stylesheet, though? You should be able to turn any borderline document into a sane one, I think, simply by making sure that all the qualified names use the same prefix and removing the extra namespace declaration. Evan posted some stylesheets to do this - http://www.xmlportfolio.com/namespaces/ - though you should make sure that you keep the non-default namespace declaration and adjust the expressions and patterns to match. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] a namespace problem, Bryan Rasmussen | Thread | RE: [xsl] a namespace problem, Bryan Rasmussen |
Re: [xsl] explain of Joerg xslt (wa, Mike Brown | Date | [xsl] How to select a range of elem, Sreeni Chippada |
Month |