RE: XPath problem in Cocoon?

2002-12-20 Thread Luca Morandini
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
>
> 
>  a node to match
> 
>
> XSL:
>
>  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:test="test">
>
> 
> 
>
>  1. test using "//p":
>   matched
>
>
>  2. test using "//test:p":
>   matched
>
>
>  3. test using "//*[name() = 'p']":
>   matched
>
>
>  4. test using "//*[name() = 'test:p']":
>   matched
>
> 
> 
>
> 
>
> 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]>




Re: XPath problem in Cocoon?

2002-12-19 Thread Joerg Heinicke
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


a node to match


XSL:

http://www.w3.org/1999/XSL/Transform"; xmlns:test="test">



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





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. 

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



Re: XPath problem in Cocoon?

2002-12-19 Thread Anna Afonchenko
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

- Original Message -
From: "Luca Morandini" <[EMAIL PROTECTED]>
To: "Cocoon-users" <[EMAIL PROTECTED]>
Sent: Thursday, December 19, 2002 10:43 AM
Subject: RE: XPath problem in Cocoon?


Anna,

this is the output I got from your code:


  http://www.w3.org/1999/XSL/Format";>HELLO P content = some
text

...which I suppose to be the right one.

Therefore, could it be a problem related to the configuration you're using ?

My configuration is:
- Windows 2000 Prof SP3
- Tomcat 4.0.1
- Cocoon 2.0.3 with Xalan 2.2.0.D13 (yes, Xalan 2.3.1 has some bugs,  and I
decided to step down a little).

If I were you, I would;

- Change the Xalan version

and, provided that doesn't work:

- Change the Cocoon version (provided you're not using 2.0.3, of course)

Best regards,

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


> -Original Message-
> From: Anna Afonchenko [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 19, 2002 8:35 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: XPath problem in Cocoon?
>
>
> Hi Luca.
> Thank you so much for help.
> Here are all my components:
>
> 1. the pipeline:
>
> 
> 
> 
> 
> 
>
> 2. the imput file (test.html):
>
> 
>  
>   Untitled
>  
>  
>   some text
>  
> 
>
> 3. the xsl (test.xsl):
>
> 
>  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> xmlns:fo="http://www.w3.org/1999/XSL/Format";
> xmlns:saxon="http://icl.com/saxon";
> extension-element-prefixes="saxon">
>
> 
>  
>   HELLO 
>   
>P content = 
>
>   
>  
> 
> 
>
> As you can see, with such xml and xsl I should have one match for p
element
> and it's content should be output inside the root element. But it just
> doesn't happen, it doesn't match the node. And now the interesting part
> strats:
> If I replace the select attribute of xsl:for-each to be
> "descendant::node()[name()='p']"
> instead of just "//p" (those two expressions mean exactly the same in the
> XPath),
> I suddenly get the match and the right answer from Cocoon.
> Also, if I run this stylesheet externally of Cocoon (for example, using
> XMLSpy XSLTransformation tool) I get the right answer for match "//p".
>
> So I know that my stylesheet is OK, but I can't understand why it doesn't
> work from Cocoon.
> If somebody can explain this thing for me, I would be more than happy,
> because I can't use the descendant::... style instead the // style in my
> real (big) stylesheet.
>
> Thank you all very much.
> Hope somebody can help me with this.
>
> Regards,
> Anna
>
>


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


-
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]>




RE: XPath problem in Cocoon?

2002-12-19 Thread Luca Morandini
Anna,

this is the output I got from your code:

 
  http://www.w3.org/1999/XSL/Format";>HELLO P content = some text

...which I suppose to be the right one.

Therefore, could it be a problem related to the configuration you're using ?

My configuration is:
- Windows 2000 Prof SP3
- Tomcat 4.0.1
- Cocoon 2.0.3 with Xalan 2.2.0.D13 (yes, Xalan 2.3.1 has some bugs,  and I decided to 
step down a little).

If I were you, I would;

- Change the Xalan version

and, provided that doesn't work:

- Change the Cocoon version (provided you're not using 2.0.3, of course)

Best regards,

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

> -Original Message-
> From: Anna Afonchenko [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 19, 2002 8:35 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: XPath problem in Cocoon?
> 
> 
> Hi Luca.
> Thank you so much for help.
> Here are all my components:
> 
> 1. the pipeline:
> 
> 
> 
> 
> 
> 
> 
> 2. the imput file (test.html):
> 
> 
>  
>   Untitled
>  
>  
>   some text
>  
> 
> 
> 3. the xsl (test.xsl):
> 
> 
>  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> xmlns:fo="http://www.w3.org/1999/XSL/Format";
> xmlns:saxon="http://icl.com/saxon";
> extension-element-prefixes="saxon">
> 
> 
>  
>   HELLO 
>   
>P content = 
>
>   
>  
> 
> 
> 
> As you can see, with such xml and xsl I should have one match for p element
> and it's content should be output inside the root element. But it just
> doesn't happen, it doesn't match the node. And now the interesting part
> strats:
> If I replace the select attribute of xsl:for-each to be
> "descendant::node()[name()='p']"
> instead of just "//p" (those two expressions mean exactly the same in the
> XPath),
> I suddenly get the match and the right answer from Cocoon.
> Also, if I run this stylesheet externally of Cocoon (for example, using
> XMLSpy XSLTransformation tool) I get the right answer for match "//p".
> 
> So I know that my stylesheet is OK, but I can't understand why it doesn't
> work from Cocoon.
> If somebody can explain this thing for me, I would be more than happy,
> because I can't use the descendant::... style instead the // style in my
> real (big) stylesheet.
> 
> Thank you all very much.
> Hope somebody can help me with this.
> 
> Regards,
> Anna
> 
> 


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

-
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]>




Re: XPath problem in Cocoon?

2002-12-18 Thread Anna Afonchenko
Hi Luca.
Thank you so much for help.
Here are all my components:

1. the pipeline:







2. the imput file (test.html):


 
  Untitled
 
 
  some text
 


3. the xsl (test.xsl):


http://www.w3.org/1999/XSL/Transform";
xmlns:fo="http://www.w3.org/1999/XSL/Format";
xmlns:saxon="http://icl.com/saxon";
extension-element-prefixes="saxon">


 
  HELLO 
  
   P content = 
   
  
 



As you can see, with such xml and xsl I should have one match for p element
and it's content should be output inside the root element. But it just
doesn't happen, it doesn't match the node. And now the interesting part
strats:
If I replace the select attribute of xsl:for-each to be
"descendant::node()[name()='p']"
instead of just "//p" (those two expressions mean exactly the same in the
XPath),
I suddenly get the match and the right answer from Cocoon.
Also, if I run this stylesheet externally of Cocoon (for example, using
XMLSpy XSLTransformation tool) I get the right answer for match "//p".

So I know that my stylesheet is OK, but I can't understand why it doesn't
work from Cocoon.
If somebody can explain this thing for me, I would be more than happy,
because I can't use the descendant::... style instead the // style in my
real (big) stylesheet.

Thank you all very much.
Hope somebody can help me with this.

Regards,
Anna


- Original Message -
From: "Luca Morandini" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 18, 2002 11:24 PM
Subject: RE: XPath problem in Cocoon?


Anna,

ok, let's try to sort it out, send us:

- The pipeline
- The XML to be transformed
- The XSLT

Possibly, strip off all the unnecessary stuff.

Best regards,

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


> -Original Message-----
> From: Anna Afonchenko [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 18, 2002 3:25 PM
> To: [EMAIL PROTECTED]
> Subject: Re: XPath problem in Cocoon?
>
>
> Hi Konstantin.
> I know that my stylesheet works without Cocoon, I ran it through the batch
> file, using saxon. Even if I just run it using XSL Transformation of
XMLSpy,
> it works fine, and chooses the //p tags as it should.
> So I am sure the problem is with Cocoon, but I don't understand, if it's
my
> problem giving cocoon some wrong parameters (I don't know how this could
> happen) or maybe it is Cocoon problem? Using //node-name is a common XPath
> expression, it should work.
>
> Maybe somebody knows what's wrong?
> Does nobody having problems with matching this kind of XPath expression in
> Cocoon?
> It is very important for me, so if somebody can give me a hint of where
the
> problem lies, I would really appreciate this.
>
> Thank you very much for helping
>
> Anna
>


-
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]>




Re: XPath problem in Cocoon?

2002-12-18 Thread Joerg Heinicke
For me it looks like a problem with a default namespace. Is anywhere in 
the XML something like:

http://www.foo.com";>
  one of your paragraphs


??

Then you must bind this namespace to a namespace-prefix in the XSLT:


xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:foo="http://www.foo.com";>


  

  




Regards,

Joerg

Anna Afonchenko wrote:
Hi Konstantin.
I know that my stylesheet works without Cocoon, I ran it through the batch
file, using saxon. Even if I just run it using XSL Transformation of XMLSpy,
it works fine, and chooses the //p tags as it should.
So I am sure the problem is with Cocoon, but I don't understand, if it's my
problem giving cocoon some wrong parameters (I don't know how this could
happen) or maybe it is Cocoon problem? Using //node-name is a common XPath
expression, it should work.

Maybe somebody knows what's wrong?
Does nobody having problems with matching this kind of XPath expression in
Cocoon?
It is very important for me, so if somebody can give me a hint of where the
problem lies, I would really appreciate this.

Thank you very much for helping

Anna

- Original Message -
From: "Konstantin Piroumian" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 18, 2002 3:17 PM
Subject: Re: XPath problem in Cocoon?


Anna,
(please avoid HTML emails)

Cocoon uses underlying XSLT engine to perform the transformation, so either
this is just an XSLT problem in your code or a problem of the Xalan or XSLTC
(which one is used).

You can simply check if your stylesheet works without Cocoon: run Xalan from
the command line with your XML as input and see what happens.

Konstantin

- Original Message -
From: Anna Afonchenko
To: cocoon-users
Sent: Wednesday, December 18, 2002 16:01
Subject: XPath problem in Cocoon?


Hi all.
Another question for today:
I wrote a small xsl that matches p nodes from the input and prints their
content.
I wrote it like this:


Content of this tag is 




Then I run this stylesheet through cocoon pipeline.
I get empty result, e.g. the for-each didn't match any p node in the input
xml file.
But there are p tags in the input.
Moreover, if I change the for-each statement to

It executes correctly!

Can anyone explain to me, why Cocoon doesn't match //node-name?
In XPath both //node-name and descendant::node()[name()='node-name'] have
the same meaning.
I dont want to use descendant::... style because I have this stylesheet get
the XPath expression to match from some external xml file, and it is really
a headache (if possible at all) to change all my //node-name expressions to
descendant::node()[name()='node-name'] style.

Please explain this mistery to me.

Thank you very much for help.
I know I am writing too many e-mails to the group these days, but since I am
very new to Cocoon, I get stuck every few minutes on something new.

Regards,
Anna


-
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]>





-
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]>




RE: XPath problem in Cocoon?

2002-12-18 Thread Luca Morandini
Anna,

ok, let's try to sort it out, send us:

- The pipeline
- The XML to be transformed
- The XSLT

Possibly, strip off all the unnecessary stuff.

Best regards,

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

> -Original Message-
> From: Anna Afonchenko [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 18, 2002 3:25 PM
> To: [EMAIL PROTECTED]
> Subject: Re: XPath problem in Cocoon?
> 
> 
> Hi Konstantin.
> I know that my stylesheet works without Cocoon, I ran it through the batch
> file, using saxon. Even if I just run it using XSL Transformation of XMLSpy,
> it works fine, and chooses the //p tags as it should.
> So I am sure the problem is with Cocoon, but I don't understand, if it's my
> problem giving cocoon some wrong parameters (I don't know how this could
> happen) or maybe it is Cocoon problem? Using //node-name is a common XPath
> expression, it should work.
> 
> Maybe somebody knows what's wrong?
> Does nobody having problems with matching this kind of XPath expression in
> Cocoon?
> It is very important for me, so if somebody can give me a hint of where the
> problem lies, I would really appreciate this.
> 
> Thank you very much for helping
> 
> Anna
> 


-
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]>




Re: XPath problem in Cocoon?

2002-12-18 Thread Anna Afonchenko
Hi Konstantin.
I know that my stylesheet works without Cocoon, I ran it through the batch
file, using saxon. Even if I just run it using XSL Transformation of XMLSpy,
it works fine, and chooses the //p tags as it should.
So I am sure the problem is with Cocoon, but I don't understand, if it's my
problem giving cocoon some wrong parameters (I don't know how this could
happen) or maybe it is Cocoon problem? Using //node-name is a common XPath
expression, it should work.

Maybe somebody knows what's wrong?
Does nobody having problems with matching this kind of XPath expression in
Cocoon?
It is very important for me, so if somebody can give me a hint of where the
problem lies, I would really appreciate this.

Thank you very much for helping

Anna

- Original Message -
From: "Konstantin Piroumian" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 18, 2002 3:17 PM
Subject: Re: XPath problem in Cocoon?


Anna,
(please avoid HTML emails)

Cocoon uses underlying XSLT engine to perform the transformation, so either
this is just an XSLT problem in your code or a problem of the Xalan or XSLTC
(which one is used).

You can simply check if your stylesheet works without Cocoon: run Xalan from
the command line with your XML as input and see what happens.

Konstantin

- Original Message -
From: Anna Afonchenko
To: cocoon-users
Sent: Wednesday, December 18, 2002 16:01
Subject: XPath problem in Cocoon?


Hi all.
Another question for today:
I wrote a small xsl that matches p nodes from the input and prints their
content.
I wrote it like this:


Content of this tag is 




Then I run this stylesheet through cocoon pipeline.
I get empty result, e.g. the for-each didn't match any p node in the input
xml file.
But there are p tags in the input.
Moreover, if I change the for-each statement to

It executes correctly!

Can anyone explain to me, why Cocoon doesn't match //node-name?
In XPath both //node-name and descendant::node()[name()='node-name'] have
the same meaning.
I dont want to use descendant::... style because I have this stylesheet get
the XPath expression to match from some external xml file, and it is really
a headache (if possible at all) to change all my //node-name expressions to
descendant::node()[name()='node-name'] style.

Please explain this mistery to me.

Thank you very much for help.
I know I am writing too many e-mails to the group these days, but since I am
very new to Cocoon, I get stuck every few minutes on something new.

Regards,
Anna


-
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]>




Re: XPath problem in Cocoon?

2002-12-18 Thread Konstantin Piroumian
Anna,
(please avoid HTML emails)

Cocoon uses underlying XSLT engine to perform the transformation, so either
this is just an XSLT problem in your code or a problem of the Xalan or XSLTC
(which one is used).

You can simply check if your stylesheet works without Cocoon: run Xalan from
the command line with your XML as input and see what happens.

Konstantin

- Original Message -
From: Anna Afonchenko
To: cocoon-users
Sent: Wednesday, December 18, 2002 16:01
Subject: XPath problem in Cocoon?


Hi all.
Another question for today:
I wrote a small xsl that matches p nodes from the input and prints their
content.
I wrote it like this:


Content of this tag is 




Then I run this stylesheet through cocoon pipeline.
I get empty result, e.g. the for-each didn't match any p node in the input
xml file.
But there are p tags in the input.
Moreover, if I change the for-each statement to

It executes correctly!

Can anyone explain to me, why Cocoon doesn't match //node-name?
In XPath both //node-name and descendant::node()[name()='node-name'] have
the same meaning.
I dont want to use descendant::... style because I have this stylesheet get
the XPath expression to match from some external xml file, and it is really
a headache (if possible at all) to change all my //node-name expressions to
descendant::node()[name()='node-name'] style.

Please explain this mistery to me.

Thank you very much for help.
I know I am writing too many e-mails to the group these days, but since I am
very new to Cocoon, I get stuck every few minutes on something new.

Regards,
Anna


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

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