Joerg,

indeed, namespaces could be a problem when you forget to properly use them... but not 
in this particular problem.

The code Anna sent us works just fine on my Cocoon, hence, I think the problem lies 
with Anna's configuration, moreover, I
experienced nasty bugs with Xalan already.

Best regards,

---------------------------------------------
               Luca Morandini
               GIS Consultant
              [EMAIL PROTECTED]
http://utenti.tripod.it/lmorandini/index.html
---------------------------------------------


> -----Original Message-----
> From: Joerg Heinicke [mailto:[EMAIL PROTECTED]]
> Sent: Friday, December 20, 2002 1:43 AM
> To: [EMAIL PROTECTED]
> Subject: Re: XPath problem in Cocoon?
>
>
> 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>
> </root>
>
> XSL:
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:test="test">
>
> <xsl:template match="/">
> <table border="1">
>    <tr>
>      <td>1. test using "//p":</td>
>      <td><xsl:value-of select="count(//p)"/> matched</td>
>    </tr>
>    <tr>
>      <td>2. test using "//test:p":</td>
>      <td><xsl:value-of select="count(//test:p)"/> matched</td>
>    </tr>
>    <tr>
>      <td>3. test using "//*[name() = 'p']":</td>
>      <td><xsl:value-of select="count(//*[name() = 'p'])"/> matched</td>
>    </tr>
>    <tr>
>      <td>4. test using "//*[name() = 'test:p']":</td>
>      <td><xsl:value-of select="count(//*[name() = 'test:p'])"/> matched</td>
>    </tr>
> </table>
> </xsl:template>
>
> </xsl:stylesheet>
>
> Result:
>
> 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.
>
> Regards,
>
> Joerg
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
> For additional commands, e-mail:   <[EMAIL PROTECTED]>
>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to