Re: XSL content:encoded troubles

Michael Vincent van Rantwijk <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xml
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
Martin Honnen wrote:
> 
> 
> Michael Vincent van Rantwijk wrote:
> 
> 
>>> So make sure your stylesheet element for instance has e.g.
>>>   <xsl:stylesheet
>>>     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>>>     version="1.0"
>>>     xmlns:content="http://example.com/2005/09/01/n1">
>>> where you replace http://example.com/2005/09/01/n1 with the namespace 
>>> URI the elements in the source document are in.
>>
>>
>> Do I need to add the output of
>> document.documentElement.namespaceURI as URI for xmlns:content="" ?
> 
> No, not necessarily, it all depends on your input document and the 
> namespaces used there. You were using an XPath expression
>   content:encoded
> so you are looking for elements in your input document probably where 
> the local name of the element is 'encoded' and the element is in some 
> namespace. Which namespace that is I don't know and can't tell without 
> seeing the input document. It can be simple that you just have elements 
> all in one default namespace e.g.
>   <root xmlns="http://example.com/2005/09/02/ns1">
>     <encoded />
>   </root>
> you can have all elements being in the same namespace but using a prefix 
> in the names e.g.
>   <content:root xmlns:content="http://example.com/2005/09/02/ns1">
>     <content:encoded />
>   </content:root>
> But you could have some elements in no namespace and nevertheless an 
> encoded element in some namespace e.g.
>   <root>
>     <content:encoded xmlns:content="http://example.com/2005/09/02/ns1" />
>   </root>
> 
> So the namespaceURI is certainly somewhere in the input document but no 
> necessarily the one of the documentElement.

Hm, it doesn't seem like the best thing to do, but it might be valid, so 
I understand it.

Michael
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.