Re: More checked into CVS

> I had a similar problem. It seems that when the namespaces are  
> included
> in the moki document:
>
> <moki xmlns="http://moki.mobi/2007/v0.1"
> xmlns:http="http://www.w3.org/2006/http#"
>      xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
>
> , xpath queries from the root node don't work, but things like
> //html/head/title would still work.
>
> When I removed the namespaces the queries seemed to work for me, so  
> I've
> been tailoring my xpath off-line in the hope that someone else  
> knows how
> to get around this...
You have to add the namespace in your stylesheet:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
								xmlns:xmlns="http://moki.mobi/2007/v0.1">

         <xsl:output method="xml" version="1.0" encoding="UTF-8"/>

         <xsl:template match="/">
           <test><xsl:value-of select="/xmlns:moki//html/head/ 
title"></xsl:value-of></test>
         </xsl:template>
</xsl:stylesheet>

Another way is to use the local-name:
/*[local-name() = 'moki']/...

>> There is still some problem with how I'm writing XSL. Selecting for
>> the existing of nodes just isn't working no matter what I try. Maybe
>> someone with more XSL knowledge can look at CachingTest.xsl?
The current XSL is written in XSLT 2.0.
Is XSLT 2.0 needed, or should XSLT 1.0 be used?
If XSLT 2.0 needed, knows anyone a light command line XSLT processor  
for Mac OS X?

  Roland

Received on Tuesday, 15 May 2007 08:43:13 UTC