- From: Roland Gülle <roland@7val.com>
- Date: Tue, 15 May 2007 16:49:16 +0200
- To: "Jo Rabin" <jrabin@mtld.mobi>
- Cc: <public-mobileok-checker@w3.org>
>> <xsl:stylesheet... xmlns:moki="http://moki.mobi/2007/ >> v0.1" ...xmlns="http://moki.mobi/2007/v0.1"> >> to use XPath like: >> /moki:moki//moki:docContent >> > > But if you say xmlns="http://moki.mobi/2007/v0.1" in you > stylesheet, you don't need to use the prefix when selecting moki > elements, providing there is a similar namespace declaration at the > root of the moki doc, or am I missing the point? I'm not sure - this example don't work with my XSLT processor (libxslt V10111). Maybe it is only a libxslt problem? ---- xsl --- <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://moki.mobi/2007/v0.1"> <xsl:output method="xml" version="1.0" encoding="UTF-8"/> <xsl:template match="/"> <test name="namespace"><xsl:value-of select="/moki"/></test> </xsl:template> </xsl:stylesheet> ---- xml ----- <?xml version="1.0" encoding="UTF-8"?> <moki xmlns="http://moki.mobi/2007/v0.1">moki</moki> >> But is there an issue with the _real_ document namespaces? >> In this example, the document has an empty namespace: >> <docContent> >> <html xmlns=""> >> ... >> What if the document uses different/other namespaces? >> > > Oops, it should say <html xmlns="http://www.w3.org/1999/xhtml"> I > just noticed that the example moki doc from before has <html > xmlns=""> which is wrong. > > So providing the html is namespaced properly and the stylesheet > says something like > > <xsl:stylesheet... xmlns="http://moki.mobi/2007/v0.1" > xmlns:html="http://www.w3.org/1999/xhtml"> > > > then the XPath expression //primaryDoc//html:html should select the > content of the primary document ... This don't not work with my XSLT processor. I tested it with <xsl:value-of select="//docContent//html:html"/>. Is this working with your XSLT processor? > ... with regard to the following: > >> Should we always use 'namespace-safe' XPath (//*[local-name() = >> 'html'])? >> Should namespaces be removed by the 'moki doc generator' inside the >> docContent? >> > No, I don't think so, [though I often do this :-)], because in > theory at least, your document might contain content with an html > element from another namespace ... thats right - how should we handle unknown namespaces? (I know some mobile pages, that contains namespaces on different elements, generated by their output engines [of course, not our engine ;-)]. ) roland
Received on Tuesday, 15 May 2007 14:56:06 UTC