cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Ziegeler" <cziege...@s-und-n.de>
Subject RE: XPathDirGenerator and namespaces
Date Fri, 24 May 2002 11:06:11 GMT
If you use XPath, you can do something like
resource[namespace-uri()='http://www.hippo.nl/xml/resource']/caption[namespa
ce-uri()='http://www.hippo.nl/xml/resource']

Does not look very pretty, but works.

HTH
Carsten

> -----Original Message-----
> From: Rogier Peters [mailto:Rogier@hippo.nl]
> Sent: Friday, May 24, 2002 12:55 PM
> To: cocoon-dev@xml.apache.org
> Subject: XPathDirGenerator and namespaces
>
>
> Hello,
>
> While testing the xpath directory generator i ran into the
> following problem:
> The xpath queries don't work on elements that are in a namespace
> but don't have a prefix.
> For instance if I run
> somedir#/resource/caption|resource/index on the following xml
>
> <resource xmlns="http://www.hippo.nl/xml/resource">
> 	<caption>Pers</caption>
> 	<index>4</index>
> 	<layout>layout/Overzicht_pagina.xml</layout>
> 	<content>
> 	   <some:element xmlns:some="http://www.some.org/some">
> 		<xhtml:p
> xmlns:xhtml="http://www.w3.org/1999/xhtml">some content</xhtml:p>
> 	   </some:element>
> 	</content>
> </resource>
>
> the result is empty.
> The same thing happens with xsl processing, but there the
> solution is easy: i define the namespace in xsl as prefixed:
> <xsl:stylesheet version="1.0"
> xmlns:res="http://www.hippo.nl/xml/resource" (...)
> this lets me call the element res:resource
>
> So I guess the solution would be something like letting the
> XpathProcessor know which namespace binds to which prefix, but
> I'm not sure how to do this. Other than changing the xml format
> used, are there any ideas?
>
> Regards,
>
> Rogier Peters
>
>
> ---------------------------------------------------------
> Content Management Department
> Hippo Webworks
> Grasweg 35
> 1031 HW Amsterdam
> The Netherlands
> Tel  +31 (0)20 6345173
> Fax +31 (0)20 6345179
> Rogier(at)hippo(dot)nl / www.hippo.nl
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message