cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <>
Subject Re: XPath problem in Cocoon?
Date Fri, 20 Dec 2002 00:43:08 GMT
Anna Afonchenko wrote:
> Hi Luca. Thank you for answering. Yes, probably that's something with my
> configuration. I am using Win98, Tomcat 4.1.12, Cocoon 2.0.4, Xalan 2.4.1.
> I'll try to change the Xalan version.
> Anyway, this thing is very weird.
> Thank you.
> Anna

Hello Anna,

may I point out again, that in my opinion it is a simple namespace 
problem. Ok, it's only a guess, but I never heart of a bug like you 
describe. And exactly this behaviour is comprehensible with the 
following test case:

XML: elements are in default namespace

<root xmlns="test">
     <p>a node to match</p>


<xsl:stylesheet version="1.0" 
xmlns:xsl="" xmlns:test="test">

<xsl:template match="/">
<table border="1">
     <td>1. test using "//p":</td>
     <td><xsl:value-of select="count(//p)"/> matched</td>
     <td>2. test using "//test:p":</td>
     <td><xsl:value-of select="count(//test:p)"/> matched</td>
     <td>3. test using "//*[name() = 'p']":</td>
     <td><xsl:value-of select="count(//*[name() = 'p'])"/> matched</td>
     <td>4. test using "//*[name() = 'test:p']":</td>
     <td><xsl:value-of select="count(//*[name() = 'test:p'])"/> matched</td>



1. test using "//p":                     0 matched
2. test using "//test:p":                1 matched
3. test using "//*[name() = 'p']":       1 matched
4. test using "//*[name() = 'test:p']":  0 matched

Your cases are number 1 and 3 and you can see the same behaviour. Have a 
look into your XML file, whether a default namespace is set there. The 
reason for the differences when using default namespace is, that you 
must bind it in XSLT on a prefix. You can not match on elements via //p, 
if they are in default namespace.



Please check that your question  has not already been answered in the
FAQ before posting.     <>

To unsubscribe, e-mail:     <>
For additional commands, e-mail:   <>

View raw message